Skip navigation
tony03270327
Currently Being Moderated

z index bug

Apr 13, 2012 6:52 AM

Hello! need a bit -of-help.

 

 

Under browser compatability, I get the following message:

 

 

Positioned containers define a new stacking order, even when the computed z-index of the container is auto. This can cause positioned children of the container to appear above other positioned elements on the page when they should not.

Affects: Internet Explorer 6.0, 7.0

Likelihood: Likely

 

 

How do i make this right?

 

 

 

 

Thanks, Tony

 
Replies
  • Currently Being Moderated
    Apr 13, 2012 6:58 AM   in reply to tony03270327

    The answer is in the code my friend.

     

    At this stage you are the only one that has seen that code, which puts you in the best position to answer.

     

    Gramps

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 13, 2012 7:56 AM   in reply to tony03270327

    Maybe this will help clear up any misunderstanding you have about declared positioning as well as the use of z-indexing:

    The actual display of a positioned element will depend on whether or not it's parent element also has a declared position or not.

    z-indexing ONLY works with elements that have a declared position.

    Using a declared position like absolute tells and browser to take that element out of the natural flow and do something different with it. So you've got the browser parsing in order from top to bottom, then throwing in some elements that are completely out of the flow.... they can be very hard to control, because there are special rules that apply to elements with declared positions.

    The least understood of those rules is what I call the "Parent Rule". Giving an element a declared position like relative or absolute can have huge differences in how that element is actually displayed depending on whether or not the PARENT of that element also has a declared position.

    So a div which is position:absolute for example will display one way if it's parent also has a declared position and it will display in a completely different manner if it's parent does NOT have a declared position... to review:

    If a div's parent container DOES NOT also have a declared position, the child <div> will do 1 of 2 things.
    If position:relative, it will position as desired but space will be left as though that element was still in the natural flow. So you may move the 500 X 100 element down and over, but a 500 X 100 space will be left, as though it was still there.
    If position:absolute, child is positioned relative to browser window and that position does not change even if window contracts or expands.

    So be sure to give a declared position to both the parent and the child <div>.

     

    Neglecting to follow this rule is the main reason why the use of declared positioning fails.

    And just one more point, almost never is it necessary to use a declared position, and that method certainly should not be used for general page layout.

    But if and when a special situation comes up that you really do need z-indexing... then of course you will also have to use a declared position. Understanding the "Parent Rule" will make working with z-indexing and declared positions much easier and more successful.

    Best wishes,

    Adninjastrator

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 13, 2012 9:02 AM   in reply to adninjastrator

    I'm grateful for that explanation too.

     

    Thanks Adninjastrator.

     

    Martin

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 13, 2012 10:19 AM   in reply to martcol

    You are both very welcome!

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points