August 25, 200917 yr I'm trying to centre my nav bar but it seems to me not exaclty in the centre, its more over to the right! What am i doing wrong people? many thanks for your help. The css is below... #nav { float: left; margin-top:8px; margin-left: 1px; width:100%; } ul.nav { margin: -12px 2px 10px 0px; white-space: nowrap; font-size: 1.5em; text-align:center; background-color:#660000; padding-bottom: 10px; padding-top: 10px; } li.nav { display: inline; list-style-type: none; padding-right: 15px; } a.nav { text-decoration: none; color: #E1D694; font-style: normal; font-family: Arial, Helvetica, sans-serif; margin: 10px 0px 10px 0px; }
August 25, 200917 yr Have you got a link to a live site or could you post the html too? To me the 1px left margin on #nav looks dodgy as it has a width of 100% already. How far out of centre is it?
August 26, 200917 yr All the styles for #nav make it stick to the left; float: left makes it start on the left and margin-left: 1px makes it 1px away from the left side and it then extends for the full width. Try this:- #nav { width: ??px; margin:8px auto 0 auto; } which is margins for top, right, bottom and left. Choose a width and the auto margins will center the #nav.
August 26, 200917 yr Author ive put the site live but please ignore the text etc as im just working on the layout for now. Were talking like 1cm out. I did try your suggestion but to no effect the site is here
Create an account or sign in to comment