Vertical margins collapse. The resulting margin width is the maximum of the adjoining margin widths. In the case of negative margins, the maximum of the absolute values of the negative adjoining margins is deducted from the maximum of the positive adjoining margins.
'margin: 12px'
'margin: 12px'
Both paragraphs are put inside a div with 'background: gray' and 'width: 600px;' specified.
Rendering is different: Internet Explorer 6 and 5.x vs Firefox (1.5, 2.0) and Opera 9.
'margin: 12px'
'margin-top: -12px'
The second paragraph has here 'margin-top: -12px'
Rendering is different: Internet Explorer 6 and 5.x vs Firefox (1.5, 2.0) and Opera 9.
Vertical margins do not collapse (not even between a float and its in-flow children)
'margin: 10px 0'
Rendering is different: Internet Explorer 6 and 5.x vs Firefox (1.5, 2.0) and Opera 9.
Vertical margins do not collapse with their in-flow children.
'margin: 12px'
Rendering is different: Internet Explorer (6, 5.x) and Firefox (1.5, 2.0) vs Opera 9.
Margins do not collapse (not even with their in-flow children).
'margin: 10px 0' 'position: absolute' 'top: 0' 'left: 0'
'margin: 10px 0' 'position: absolute' 'top: 50px' 'left: 0'
Rendering is different: Internet Explorer (6, 5.x) and Opera 9 vs Firefox (1.5, 2.0).
Margins do not collapse (not even with their in-flow children).
Rendering is different: Internet Explorer 6 and Opera 9 vs Firefox (1.5, 2.0).
'margin-left: 10px' 'width: auto' 'margin-right: -50px'
10px + 0 ('border-left) + 0 ('padding-left')+ 640px ('width: auto') + 0 ('padding-right') + 0 ('border-right') -50px ('margin-right') = 600px (width of the container)
Rendering is different: Internet Explorer (6, 5.x) vs Firefox (1.5, 2.0) and Opera 9.