Margin property is rendered incorrectly if contained in a block-level element with no padding

RESOLVED INVALID

Status

()

--
major
RESOLVED INVALID
15 years ago
12 years ago

People

(Reporter: michael, Assigned: dbaron)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

15 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6a) Gecko/20031002 Firebird/0.7+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6a) Gecko/20031002 Firebird/0.7+

In the page at http://www.insitesinc.com/problem.html I have placed a detailed
and thourough explanation of the problem. Simple stated however Mozilla isnt
correctly rendering the top and bottom margin properties when a block-level
elements resides inside another block-level element. Unless i specify a non-zero
padding value for the ancestor (container) the margins are incorrectly
calculated and displayed on the margin-top and margin-bottom.

Reproducible: Always

Steps to Reproduce:
1. Open browser.
2. Goto URL (http://www.insitesinc.com/problem.html).
3. Gasp in horror.
Actual Results:  
Displayed the child blocklevel elements without top or bottom margins where the
content meets the ancestor element.

Expected Results:  
Made space above and below the child elements when obeying the margin property.

Please feel free to contact me for further information or to correct my
misunderstandings.

Comment 1

15 years ago
The page renders as expected - adjoining margins collapse:
http://www.w3.org/TR/CSS21/box.html#collapsing-margins

-> INVALID
Status: UNCONFIRMED → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → INVALID
(Reporter)

Comment 2

15 years ago
I have read the new expanded 2.1 Working Draft (was reading 2REC) and still feel
that there is a misimplementation. Could you please point out the specific part
of the collapsing margins section that you are referring to. Sorry to be a
bother but i think it is an important issue.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
http://www.w3.org/TR/CSS21/visudet.html#q19 - 3d paragraph of section 10.6.3.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 15 years ago15 years ago
Resolution: --- → INVALID
(Reporter)

Comment 4

15 years ago
At http://www.w3.org/TR/CSS21/box.html#collapsed-through
Spec Says:
"If the top and bottom margins of a box are adjacent..."
Does Spec Mean:
"If the top and bottom margins of two boxes are adjacent..."

I took the use of the singular article 'a' to mean the one and same box, where
it seems that they mean between two boxes. Odd difference but important one I think.

If they mean the later then your approach makes perfect sense at least as far as
the spec is concerned. 

As an aside however do you happen to know why the margin of a normal flow
blocklevel element should collapse through its parents content border on the top
and bottom? I dont see any justifiable reason for this but i hope one exists.

Regardless it seems that this is not a bug for Mozilla but maybe a broader
question about the spec. Thank you for the time you spent and sorry for the
trouble please feel free to close this bug but i would appreciate a response if
you know why margins "collapse through" parents content edge. It seems to me
like this shouldnt be possible.

For future use if i close a bug do you still receive the last msg i add as a
comment? Thanks again.

Comment 5

15 years ago
You mean the fifth bullet?  I think the singular 'a' is really intended there,
it's the edge case for an empty block:
<div style="margin:1em 0"></div>

Margin collapsing involving two blocks is described in the first bullet.

Yes, we recieve all messages, even when the bug is resolved.

Comment 6

12 years ago
*** Bug 321841 has been marked as a duplicate of this bug. ***

Updated

12 years ago
Duplicate of this bug: 373420
You need to log in before you can comment on or make changes to this bug.