Closed Bug 80669 Opened 24 years ago Closed 23 years ago

incorrect collapsing of margin-top

Categories

(Core :: Layout, defect, P1)

defect

Tracking

()

VERIFIED DUPLICATE of bug 44242
Future

People

(Reporter: ltu97mp, Assigned: attinasi)

References

()

Details

(Keywords: testcase)

Attachments

(3 files)

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Macintosh; U; PPC; en-US; rv:0.9) Gecko/20010505 BuildID: 2001050518 In a document where the first child of <body> is a <a name> tag which surrounds nothing (e.g. <a name="test"></a>) and it's followed by a div with vertical margins then the top margin collapses incorrectly so that there's no vertical space between the inner edge of body and the border of the div. adding a border to body causes the margins to be respected. Reproducible: Always Steps to Reproduce: 1.open a page which contains the necessary conditions. Actual Results: the top margin of the div wasn't respected Expected Results: the top margin of the div should have been respected The URL above is supposed to be a properly decomposed test case. The body style rule can be removed and the bug persists, it's just there because it emphasises the visual result of the bug. The bug is also present in Windows 0.8.1 (build id 2001032319)
Summary: incorrect collapsing of vertical margins → incorrect collapsing of margin-top
confirming on Win2K 2001051308 interestingly, this can be fixed if you add border-top to the <body> but if <body> has no border-top, margin-top of the div it contains collapses.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Mac System 9.x → All
Hardware: Macintosh → All
Adding padding-top to the body also prevents the collapsing... I had a similar problem with something else I was working on, and am wondering if there are other incorrect collapsing top margin problems related to this one. I'll resurrect this other file and upload a version of it.
This other file was, in fact, exhibiting correct behaviour (according to my reading of the spec). I also checked whether the bug occured if relative and not absolute units were involved, and it does. I've attached a slightly amended test with this.
dupe of bug 74557?
It doesn't look like a dup. I'm going to attach 2 testcases that show that the problem is broader than that. If we have 2 nested blocks and the inner block has a margin-top: - Bug #1: if an empty _inline_ element is between the outer block and the inner block, the margin is lost. - Bug #2: if there is no element between the outer block and the inner block, the margin is applied to the outer block instead of the inner block. However, if there is an empty _block_ element or if there is any non-empty element between the outer and inner blocks, the margin is correctly applied. Reassigned to Layout/attinasi.
Assignee: pierre → attinasi
Component: Style System → Layout
Attached file testcase #2: no span
Keywords: testcase
Looks like its correct in 11/02/2001 CVS build on WINNT. Note: IE 6.0 renders both of pierre's test cases the same as Mozilla. Resolving WFM.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → WORKSFORME
Target Milestone: --- → Future
WinIE5 and Mozilla are buggy in different ways on testcase #1. They are equally buggy on testcase #2. MacIE5 gets the two testcases right. Reopening. The testcases describe what is wrong and you can also compare with MacIE5.
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
I forgot to reset the milestone when I reopened the bug... I suggest moz1.0 since it is a standard compliance issue.
Target Milestone: Future → ---
Target Milestone: --- → mozilla1.0.1
Moving Mozilla 1.01 bugs to 'future' milestone with priority P1 I will be pulling bugs from 'future' milestones when scheduling later work.
Priority: -- → P1
Target Milestone: mozilla1.0.1 → Future
As far as I can tell, our layout of testcase #2 (attachment 46678 [details]) is correct (because of margin collapsing), and my patch to bug 44242 makes our layout of testcase #1 (attachment 46677 [details]) the same as our layout of testcase #2 (attachment 46678 [details]). *** This bug has been marked as a duplicate of 44242 ***
Status: REOPENED → RESOLVED
Closed: 24 years ago23 years ago
Resolution: --- → DUPLICATE
Note that my patch on bug 44242 does fix attachment 34388 [details] and http://www.home-reading.org.uk/moz0-9_testcase.html to have a margin between the top border and the top of the document equal to the one on the left side.
v
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: