Closed Bug 72060 Opened 24 years ago Closed 23 years ago

Mozilla does not properly handle margin-top for paragraphs.

Categories

(Core :: Layout: Tables, defect)

Other
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 18206

People

(Reporter: dylang, Assigned: pierre)

References

()

Details

In an effort to get a nice floaty toolbar, I concocted something like the page in the example URL. Since having the float bar over text at the top is a bad thing (but fine once they scrolled past it), I decided to have the top paragraph have a big top margin to allow the float bar to not clober it. Mozilla doesn't seem to respect this.
Looks like the top margin is being properly collapsed per the CSS2 margin collapsing rules (the testcase looks the same in strict mode as in quirks, so it's not a quirks issue). Try setting padding-top on the <p class="top"> or margin-top on the <body> element instead... recommend invalid.
Here's a margin quirk where it's collapsed when not vertical: In the style sheet: table { margin-right: 8em; } In the HTML: <table> <tr> <th colspan="2">Header</th> </tr> <tr> <td>Lotsandlotsoftext</td> </tr> </table> And the lotsandlotsoftext will not have a right margin at all. It will be collapsed (!). padding-right works as expected. http://richinstyle.com/guides/box1.htmlIt is important to note that in CSS, margins collapse vertically (except where one or more of the margins is a floating margin). This means that where two margins adjoin vertically, the margin is not equal to the combined total of the two margins, but rather to the larger of the two (except where both margins are negative, in which case the combined margin is equal to the most negative of the two margins; and where one margin is negative and the other positive, the combined margin is equal to the two margins added together). However, margins between floated or positioned elements and any other element do not collapse." The original test-case is a floating element.. perhaps the code needs to be double checked. "
Um.. you were setting a margin on the _paragraph_ not the floating element. The table example you provide works for me -- the margin is there. could you provide a testcase in which it does not work please?
Compare: http://web.thock.com/mozilla/css_bug2a.html http://web.thock.com/mozilla/css_bug2b.html Both require a right indentation of some kind for the floating element. One uses padding-right (2a), the other uses margin-right (2b).
Dylan, I would guess that that margin is clipped by the viewport, not collapsed. But you should file a separate bug on that (and comment in this one with the bug number of the new bug). Is the issue with the margin-top resolved? Or is it still a problem?
So the margin-right thing is a legit CSS bug, but I'll have to file a new report? Sigh.. I'm not sure how it's a bug myself. Would it be possible for you to submit one, or at least arm me with more knowledge? :)
no, actually, I think the margin-right thing is not a bug. But I'm not completely confident in that. :)
Ian, could you please check this out? I would say that this bug is invalid and other bugs should be filed on issues (if any) with margin-right....
Keywords: qawanted
The original bug is a dup of bug 18206. The margin-right bug is bug 83786 (which I just filed). Marking a dup of bug 18206. For the record, the guy to bug about table bugs is amar@netscape.com. :-) dylan: Thanks for the help! *** This bug has been marked as a duplicate of 18206 ***
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Component: Style System → HTMLTables
Keywords: qawanted
QA Contact: ian → amar
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.