Closed Bug 60535 Opened 24 years ago Closed 24 years ago

CSS-P absolute positioning vertical offset

Categories

(Core :: Layout, defect, P3)

x86
Linux
defect

Tracking

()

RESOLVED INVALID

People

(Reporter: raubeno, Assigned: clayton)

References

()

Details

Attachments

(3 files)

While designing a page for class I discovered that absolute positioning of
elements is miscalulated.  Everything that is absolute positioned within another
absolute positioned block container is shifted 16px down from where it should be.
makingtest
testcase
confirming -- I see this with linux trunk build 2000-11-17-08.

Is this a regression?  I believe absolute positioning used to work...
Status: UNCONFIRMED → NEW
Ever confirmed: true
Absolute positioning does work for DIV, but not for P and H*.  The offset for P
and H* is fine normally and indeed expected.  However, with ablsolute
positioning it should be toggled off.  I would expect the offset problem may
exist with tables as well, but I haven't tested it.
Doh.  The problem here is that the P and H* elements have nonzero margins!  And
absolute positioning specifies the position of the whole box (content, padding,
border, margins), not of the content.  If I set the margin on P to zero on the
original testcase (or if I do the same to H3 in Ben's testcase) the layout is
exactly the same as for divs.  I should have caught this earlier....

Marking invalid, since this is the correct CSS2 behavior.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → INVALID
Boris is right the margins are the problem.  However, this just means there is a
different bug.  My understanding is the there should never be a non-zero default
for margins.  http://www.w3.org/TR/REC-CSS2/box.html#margin-properties  Please
correct me if I'm wrong.  IE 5.5 renders the initial test case correctly with 0
margins as the default.
All that says is that unless the margins are set by a stylesheet they should be
0.  In this case the margins are set by the user-agent stylesheet for HTML 4.0.

If you look at the W3C's recommended HTML 4.0 stylesheet
(http://www.w3.org/TR/REC-CSS2/sample.html), you will see that quite a number of
elements have recommended margins.

Unfortunately, the choice of a user-agent stylesheet is up to the useragent.  So
you really can't depend on the initial values of things like margins and should
set them yourself if you really care about precise positioning....
I stand corrected.  Thank you.  Case closed.
*** Bug 119342 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: