css - border causes div to overlap past 100% by 1 or 2px -


i have our navigation bar set 100%. bar has 1px border on it. reason, border causes nav bar stick out right 1 or 2 pixels. tried setting border 0 in firebug , sure enough, lined correctly. our site here: http://clubschoicefundraising.com/

as can see, blue nav bar @ top stick out left side. can remove "right: 0" , sticks out right side. how prevent border causing nav bar stick out?

update: requested, here css nav:

nav  { position: absolute; right: 0; top: 70px; margin-top: 5px; font-size: 1.3em; font-weight: 600; list-style: none; width: 100%; margin: 5px auto; height: 43px; padding: 0; z-index: 10;  /* background color , gradients */ background: #014464; background: -moz-linear-gradient(top, #0272a7, #013953);     background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#0272a7), to(#013953)); background: -ms-linear-gradient(top, #0272a7, #013953);   background: -moz-linear-gradient(top, #3c78b9, #28507b);     background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#3c78b9), to(#28507b)); background: -ms-linear-gradient(top, #3c78b9, #28507b);    /* borders */ border: 1px solid #002232;  box-shadow:inset 0px 0px 1px #edf9ff; } 

explanation :

by default, borders calculated outside specified on element,that why overflows when give element border.

solution :

use box-sizing:border-box; border width calculated inside 100% , won't overflow. (more info on box sizing on mdn)

box-sizing:border-box; supported ie8+ (see caniuse)


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -