Closed Bug 19926 Opened 25 years ago Closed 25 years ago

z-index not working for "position: relative"

Categories

(Core :: Layout, defect, P3)

x86
Linux
defect

Tracking

()

VERIFIED INVALID

People

(Reporter: braden, Assigned: troy)

Details

(Whiteboard: Another bug needs to be filed on another problem here...)

Attachments

(1 file)

The example (to be attached) attempts to create a popup which will "float" over
the existing text. It works as expected if position is "absolute" for the popup
class, but when position is "relative", the z-index doesn't appear to be
honored.
Attached file Test case.
Works fine for me. It seems you're using Linux. Do you have access to a Windows
box so you can verify if it works for you?
I get the same behavior in Windows and Linux.

I took from your response on the newsgroup
(<URL:news://news.mozilla.org/3839795B.92BBEBC1%40netscape.com>)that the correct
behavior for this example was for the popup to overlap the text "Now for some
more text", rather than reflow the 0 layer, since that is what happens when
"position" for "popup" is "absolute".

Is that not the correct behavior?
All I meant in the posting was that z-index does apply to relatively positioned
elements. I didn't mean to imply anything about the pop-up overlapping the text

I will take another look at the test case. I didn't look at it all that
carefully, other than I noticed that pop-ups did appear when I moved over the
text and that IE5 rendered the page the same way
To make it easier to understand the answer I'm repeating your question:

"I took from your response on the newsgroup
(<URL:news://news.mozilla.org/3839795B.92BBEBC1%40netscape.com>)that the correct
behavior for this example was for the popup to overlap the text "Now for some
more text", rather than reflow the 0 layer, since that is what happens when
"position" for "popup" is "absolute".

Is that not the correct behavior?"
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → INVALID
I think the page is displaying correctly.

The popup should not overlap the text "Now for some more text", because that
text is in a different table cell.

Relative positioning is different than absolute positioning in that relatively
positioned elements remain in the flow and take up space in the flow whereas
absolutely positioned elements are moved out of the flow. See 9.4.3 of the
CSS2 spec for information on relative positioning and 9.6 for information on
absolute positioning

What I meant by "z-index" applying to all positioned elements (including
relatively positioned elements) is that if you have two (or more) relatively
positioned elements (or one relatively positioned and one absolutely positioned
element), then the "z-index" is used to determine which elements displays on
top.

Marking as INVALID because I believe we render it as intended. Re-open if you
disagree and we can discuss it some more
Braden, setting display to something not visible should cause a reflow.  The
z-index does not affect layout at all - it only effects painting.

However, there's another bug on this test case.  The text after the "popup"
doesn't move back on the mouse-out when display is changed.  Is there a bug
filed on this or do I need to file one...?
Whiteboard: Another bug needs to be filed on another problem here...
It's not clear that is a bug. It seems that what happened is that the column
widths of auto width table changed when the text was displayed. It doesn't
necessarily change back, but maybe it shouldn't. As long as it is stable

If you do create a bug, then create it against tables please
Status: RESOLVED → VERIFIED
Based on troy's comments, marking verified invalid.
The other bug (with reflows and dynamic changes to display within tables) is now
bug 20772.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: