2009/2/5 David Laakso <da...@chelseacreekstudio.com> > Cristian Palmas wrote: > >> Hi all, >> >> I have noticed a CSS behaviour that seems strange to me, so I thought of >> asking to someone for some explanation. >> I have this snippet of XHTML 1.0 strict code: >> >> <css and html trimmed> >> >> >> > > Not sure I understand what you are getting at. Or is it that I am not sure > what I am getting at :-) ? > > The height of .a is is approx 104px with .top and provides a reference (the > border) above and below h1 that tells the browser to the paint .a with > background-color #ccc. > The height of .a is is approx 102px if .top is deleted and tells the > browser to only paint h1 with background-color #ccc. > If you took it one step further, and moved background-color #ccc to .a , > and deleted .b and .top, the height of .a will be approx 102px and the > browser will paint .a with background-color #ccc. >
Hi David, I wasn't getting at something particular with that simple snippet of code. I was creating a 3-column fixed width layout and I noticed the behaviour of collapsing margin in the header div. So I studied that behaviour with that snippet of code: say #layout the .a div; say #header the .b div; say #site-title the h1. It didn't give me layout problems or else. It was just curiosity to understand that behaviour I've never seen in action before. A theoretical, not practical this time, problem I wanted to understand, since It appeared not intuitive to me. Anyway, thanks to your response and Georg's, I understood much more about collapsing margin. I also read about it in these following useful articles (besides the W3C specs, obviously - even if badly explain, for my point of view): - http://complexspiral.com/publications/uncollapsing-margins/ - http://reference.sitepoint.com/css/collapsingmargins Googling "collapsing margins" one can find other useful stuff. Regards -- ~ Cristian Palmas ~ http://www.cristianpalmas.it ______________________________________________________________________ css-discuss [cs...@lists.css-discuss.org] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/