View Full Version : A Few CSS Questions

08-30-2010, 02:26 AM
I have a header div (160px tall, 1024px wide), a header background image (same dimensions with 7px border on all sides and a 4px border going through the center at 114px to separate the top from navigation), and three internal divs (logo, ads, navigation). Logo and ads are on top, floating left and right against each other, with navigation below them. I need to position navigation so that it is perfectly aligned with the background image.
1. Are margins counted in width? I have 7px top margins on logo and ads to account for the 7px background border, so when I define their height, should it be 114px or 107px?

2. Does padding affect the width? I have logo and ad width in percentage, but to get them both on the same row I can only use 96%.

3. Why isn't clear working? I have clear: both on the navigation but it seems like it's trying to clear header (the div that it is contained in).

URL is http://stupidgamestuff.com/index2.php.

08-30-2010, 02:49 AM
The CSS box model is rather counterintuitive and padding isn't included in width, e.g. an element with 200 pixels width and 50 pixels padding will be 300 pixels wide (200 + 50 + 50). Margins aren't counted either. Doing some experiments yourself would have made this clear, though.
I can't access your site: I just get MySQL errors.

08-30-2010, 03:07 AM
I'm setting up the database, sorry about that, it should be fixed in 5-10 minutes. But yeah, I got it to work, anyway, thanks for the clarification.