Roberto Lloveras Photography,CSS and code Rants

Friday, March 31, 2006

Awesome Tutorial on Positioning

Learn CSS Positioning in Ten Steps GREAT tutorial. A must read. I cant stress how usefull this simple tutorial was for me. Now I get it!. Almost.

Here is a template that does something wierd. When I have a border around the container div everything is fine and dandy. As soon as I remove the border the template breaks. WHY WHY WHY!!!!! arrrrggggg.

Template 1 (Show Correctly)

Template 2 (Shows Incorrectly only difference it the border around it)

1 Comments:

At 10:46 AM, Patrick said...

Thanks for the link and the kind words.

Regarding your problem, it has to do with "collapsing margins" (do a google search for more info).

It is actually the top margin on the P element that is pushing everything down: the top margins of #container, #content, and the P element collapse into one margin.

When you add a top-border to #content, that prevents the margins from collapsing. Alternately you can use top-padding to do the same thing.

 

Post a Comment

<< Home