![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Ben C a écrit : [snip] title>Why the margin area is not red?</title style type="text/css" body {background-color: white; color: black; margin: 0px;} #parent_block {background-color: red; width: 100%; margin: 0px;} #nested_child_block {margin: 150px 0px; background-color: green; color: white;} /style div id="parent_block"><p id="nested_child_block">foo</p></div there is no collapsing of margin involved. MSIE 7 (final release) renders the margin area as red, not white. Firefox 2.0 and Opera 9.1 render the margin area as white, not red. I wish to understand why. [snip] So far, I understand what you say and what the spec says. And that's just what the situation is here-- the parent_block's top margin of 0px is adacent with its child's top margin of 150px. The two collapse to a resultant margin of 150px which goes above parent_block "which goes above parent_block": where do you see/read this in CSS 2.1? |
|
Where do you read that the resultant margin takes its background color from closest containing box (body in my example) within the containing hierarchy? |
![]() |
| Thread Tools | |
| Display Modes | |
| |