Forum Moderators: not2easy

Message Too Old, No Replies

Different Z-index objects have float conflict...

         

JAB Creations

12:09 am on Aug 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I was messing with code today and set my z-index: 2; to on two objects. Am I correct in assumming z-index when not declared has a default of 0? These objects would expand vertically via :hover. I needed these two objects to float next to each other. When I set float objects that had not had their z-index set where pushed downwards.

Now here is the issue of logic...

Bob is floating in the sky and Joe is on the ground. If you make bob wider or taller (height) he does so without having to change his altitude (or in this case z-index). After all z-index defines a plane of depth with the value 0 being on the "ground" and the higher the number the closer to the viewer the object becomes (even though our screens themselves are not 3-D).

Hence if an object's dimensions change on a different plane they should not effect the positioning in any way of a plane they are not on. People who work with graphics refer to z-index or planes as layers...parts of the greater picture that are in and of themselves completely independent of each other yet still part of the file.

I'm sure I could be missing something here but the initial logic requires me to hear the opinions of others. :-)

jessejump

12:10 am on Aug 29, 2005 (gmt 0)

10+ Year Member



Z index is for when element overlap

createErrorMsg

3:49 am on Aug 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



z-index applies to positioned elements only. From the W3 specs [w3.org]...

For a positioned box, the 'z-index' property specifies:

1. The stack level of the box in the current stacking context.
2. Whether the box establishes a local stacking context.

Since floated elements are not positioned, z-index has no effect on them.

Am I correct in assumming z-index when not declared has a default of 0?

No. The default is auto, which gives the element the same stacking level as it's parent and creates no local stacking context.

cEM