Hey guys, I use the following CSS to build a tab like menu bar.However, the padding is uneven.There is always an extra pixel of padding on the right whenever a bold font is used. I'm using XHTML1.1 doctype. #nav{ height:26px } #nav ul { margin:0; padding:0 } #nav ul li { display:inline} #nav a { background-color:#215390; color:#ffffff; font:bold 12px Arial, Helvetica, sans-serif; float:right; line-height:25px; margin-left:1px; padding:0 10px; text-decoration:none } Code (markup): The padding on the anchor tag produces 10px padding on the left, but 11px padding on the right.I can get the desired 10px each side by using: padding:0 9px 0 10px; Code (markup): However, I'd really like to find out why this is happening.If anyone can throw some light on this, I'd appreciate it. Thanks
Try creating individual states for your buttons ie #nav a:hover and reduce the width or padding for that hover element by 1px. Its probably just the fact that the text is bold and hence slightly larger which is causing the increase. Do you get the same effect in all browsers? or is the problem browser specific?
Hi Sabian, Thanks for your input. The problem occurs across all browsers I've tested on so far (FF2.0, IE7, O9) so I dont think it is a rendering problem, more likely a problem with the way I've set up my css. But I just can't see why using a bold font suddenly makes more padding on the right.I've tried various alignment and floating combinations just to see....but the extra padding is always on the right.If it was going to have any impact on the padding, I would have thought that there would have been less than the defined amount. It's not a huge problem....its just really bugging me