Closed Bug 286036 Opened 20 years ago Closed 20 years ago

Margin not filled with background color when outer div has no border

Categories

(Core :: Layout, defect)

1.0 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: erlend, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050223 Firefox/1.0.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050223 Firefox/1.0.1

See the example HTML-code below. When the outer div has a border, the margins of
the inner div are filled with the outer div's background color. When the border
is removed only left and right margin are filled, while the top and bottom
margin are left white.

<div style="width: 400px; margin: 0px; padding: 0px; background-color: red;
border: 1px solid #000;">
<div style="padding: 0px; margin: 5px 5px 5px 5px;">
width: 100px; margin: 0px; padding: 0px; background-color: red; border: 1px
solid #000;
</div>
</div>
<div style="width: 400px; margin: 0px; padding: 0px; background-color: red;">
<div style="padding: 0px; margin: 5px 5px 5px 5px;">
width: 100px; margin: 0px; padding: 0px; background-color: red;
</div>
</div>

Reproducible: Always

Steps to Reproduce:
1. Create a file with the HTML from details
2. Open the file in firefox :)

Actual Results:  
Margin top and bottom are not filled for the lower div

Expected Results:  
Margin top and bottom should have been filled
Assignee: firefox → nobody
Component: General → Layout
Product: Firefox → Core
QA Contact: general → layout
Version: unspecified → 1.0 Branch
I think it's just normal collapsing margins at work here; the inner DIV margin
can overspill the outer when there is no border. Also Firefox and Opera have the
same layout here, they're not often both wrong.

See: http://www.w3.org/TR/CSS21/box.html#collapsing-margins
Attached file reporter´s testcase
Comment 0 is right on; we're doing exactly what the spec says to do.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: