Closed
Bug 74557
Opened 25 years ago
Closed 23 years ago
'margin-top' is lost on element following fixed pos element.
Categories
(Core :: Layout: Block and Inline, defect, P2)
Core
Layout: Block and Inline
Tracking
()
Future
People
(Reporter: val, Unassigned)
Details
(Keywords: css1, Whiteboard: [CSS1-5.5.1][Hixie-P2])
Attachments
(3 files)
From Bugzilla Helper:
User-Agent: Mozilla/4.6 [en-gb]C-CCK-MCD NetscapeOnline.co.uk (Win98; I)
BuildID: 2001032319
It seems that, if a fixed position element is the first element in a document
BODY, then the top margin of the first element following that fixed position
element is ignored.
Reproducible: Always
Steps to Reproduce:
The attachment contains an initial fixed position element, followed by a couple
of paragraphs each with 'margin-top:100px'. Notice that the top margin of the
first paragraph is missing.
If the fixed pos element is placed anywhere else in the code, or if another
element is placed before it, then both paragraphs are rendered correctly with
100px top margins.
(A DIV will also lose its top margin, but TABLEs appear to be OK.)
Comment 2•25 years ago
|
||
looks like the top margin is collapsing -- adding a padding or border to body
makes the margin reappear. Hixie, does this seem like the right behavior? The
margin does not collapse when the fixed-position <p> is not there.... Seeing
this on linux build 2001-04-02-16 too.
OS: Windows 98 → All
QA Contact: petersen → ian
Comment 3•25 years ago
|
||
Marking NEW as per bz's comments.
Comment 4•25 years ago
|
||
--->Block layout
Comment 5•25 years ago
|
||
"position:absolute" also has this problem. "margin-top" of the following
element is ignored.
Comment 6•25 years ago
|
||
Comment 8•24 years ago
|
||
Has any progress been made on this? It looks like there hasn't been any activity
since October of last year.
I'm experiencing the problem in test case #3 -- the first object on my page is
set to 'float: right', the second has 'margin-top: 20%', and the second item is
right at the top of the page. Even if I set 'margin-top: 600px', it's right at
the top of the page.
IE5, Netscape 4 and Opera 5 all render this page properly, but Mozilla 0.9.9
gets it wrong: http://www.seanh.net/margin-test.html
On my real page, I've kind of worked around it by setting the margin-top on the
image that's inside of the box, but that unfortunately breaks it for Opera
(likely a bug in Opera, but if it weren't for the bug in Mozilla, I could do it
the "right" way by setting the margin on the box itself and make all of the
browsers happy).
Comment 9•23 years ago
|
||
The more I think about this, the more convinced I am that the real bug is in the
case when there's no fixed-pos element there...
Component: Layout → Layout: Block & Inline
Target Milestone: mozilla1.1alpha → ---
Updated•23 years ago
|
Priority: -- → P2
Target Milestone: --- → Future
Comment 10•23 years ago
|
||
yes, I have encountered this bug too. margin-top gets lost, while
margin-<others> are processed correctly. Here to files, that should render
exactly the same. Other Browsers do almost well BTHW. file1 and file2 differ in
the absolute attribute value.
file1
-----------
<html><head><style>
.book {background-color:#FFDDDD;margin-left:25%;margin-top:50%}
.navigation {position:absolute;top:20px;left:1%;width:24%}
</style>
</head>
<body><div class="navigation"> </div>
<div class="book">dddd</div></body></body>
</html>
file2
-----------
<html><head><style>
.book {background-color:#FFDDDD;margin-left:25%;margin-top:50%}
.navigation {position:relative;top:20px;left:1%;width:24%}
</style>
</head>
<body><div class="navigation"> </div>
<div class="book">dddd</div></body></body>
</html>
Comment 11•23 years ago
|
||
->Layout Block
Assignee: attinasi → block-and-inline
Whiteboard: [CSS1-5.5.1] → [CSS1-5.5.1][Hixie-P2]
I have a fix for this. See bug 44242. This has been an undetected duplicate
for ages.
*** This bug has been marked as a duplicate of 18206 ***
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•