Closed Bug 29218 Opened 25 years ago Closed 25 years ago

Absolute positioning of H1-elements not correct

Categories

(Core :: Layout, defect, P3)

x86
Windows NT
defect

Tracking

()

VERIFIED INVALID

People

(Reporter: janegil, Assigned: pierre)

References

()

Details

The two H1 elements in th URL are positioned with a vector distance (2px, 2px). Does not look like that. On the other hand葉he positioning is not ignored either (like in Opera), so I guess M13 tries to implement CSS2 ? IE5 and Netscape 4.7 looks as I expected.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Okay, I know what's causing the problem. I don't have a fix yet, but I have a workaround. On your absolutely positioned elements make sure you specify "margin-top:0" What's happening is that our user agent style sheet specifies default margins for all headings, e.g., h1 { display: block; font-size: 2em; font-weight: bold; margin: .67em 0; } There is also a rule that says that the first child of the body doesn't get a top margin: body > *:first-node { margin-top: 0; } So what is happening is that the first H1 is the first child of the body and so it gets a top margin of 0, whereas the second H1 is not and so it gets the default top margin of .67em and so they're not positioned correctly In general, it's probably a good idea to explicitly specify a top margin
Pierre, I'm assigning to you because we need style system support to fix this properly. Turns out there are lots of harmless looking rules in the user agent style sheet (html.css), that really should only to 'static' (in-flow) elements. However, I don't see a way to describe this using CSS2 selectors. It isn't really a problem for end users, because they can use class or id selectors but it's a big problem for us. What I'm asking for is a moz specific way (presumably) to be able to indicate that rules are only for 'static' position elements For example, h1 { display: block; font-size: 2em; font-weight: bold; margin: .67em 0; } body > *:first-node { margin-top: 0; }
Assignee: troy → pierre
Status: ASSIGNED → NEW
Mozilla's current behavior is correct, and I really don't see any reason to change it. Hx elements have default margins in a UA stylesheet - that's generally accepted, so authors should have to set them to 0 if they should be 0.
Current behavior is OK with me. For one, what I did is blatant misuse of CSS, that page doesn't work on non-CSS browsers. And I think it's easily fixed, I think a DIV around the two positioned elements is enough.
Closed as Invalid.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → INVALID
Status: RESOLVED → VERIFIED
Site problem not ours :) Marking as Verified.
You need to log in before you can comment on or make changes to this bug.