Closed
Bug 223875
Opened 22 years ago
Closed 22 years ago
DIV box imside dominates the margin-top attribute of outer div
Categories
(Core :: Layout, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: mgordon, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007 Firebird/0.7
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007 Firebird/0.7
When a div box with margin: 0 has a div box with margin: 2cm the second box'
margin-top will apply to the first box, ie the outer div will have a margin-top:
2cm instead of 0 as stated in the CSS.
Reproducible: Always
Steps to Reproduce:
Use this HTML code:
<html>
<head>
<link media="all" href="buggy.css" type="text/css" rel="stylesheet">
</head>
<body>
<div class="Page">
<div class="Object1">
This is the first object: <br />
margin: 1.5cm;<br />
width: 4cm;<br />
height: 3cm;<br />
padding: 0.5cm;<br />
border: 0cm;<br />
</div>
</div>
</body></html>
And this CSS code:
.Object1 {
margin: 1.5cm;
width: 4cm;
height: 3cm;
padding: 0.5cm;
border: 0cm;
position: relative;
background-color: grey;
color: white;
}
.Page {
margin: 0cm;
padding: 0cm;
border: 0cm;
top: 0cm;
width: 21cm;
height: 29.7cm;
position: relative;
background: white;
}
body {
margin: 0cm;
padding: 0cm;
background: yellow;
}
This is the correct behavior. See:
http://www.w3.org/TR/CSS21/box.html#collapsing-margins
http://www.w3.org/TR/CSS21/visudet.html#q19
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
| Reporter | ||
Comment 2•22 years ago
|
||
Sorry about that. I have tried to read the w3c:s docs but they are just to
uncomprehensive and I can't say that I quite understand their logic sometimes
:-/ Thanks for explainging the phenomena to me. Guess you get a lot of these....
You need to log in
before you can comment on or make changes to this bug.
Description
•