SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: bring to front

  1. #1
    SitePoint Wizard
    Join Date
    Jan 2005
    Location
    blahblahblah
    Posts
    1,447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    bring to front

    Hi,
    I can't remember how to force a div to be on top of other layers, no matter where it's located code-wise.
    Is that feasible?

  2. #2
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hrmph, on second look it appears that only works with absolutely positioned elements Anyone know how to do this with non absolutely positioned elements?

  4. #4
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,108
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    z-index:2; probably would do.
    A trillion seems a little overboard to me!

    Hrmph, on second look it appears that only works with absolutely positioned elements Anyone know how to do this with non absolutely positioned elements?
    Perhaps position: relative; ?
    A few things need to be anything but the default 'static'

  5. #5
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,339
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    I can't remember how to force a div to be on top of other layers, no matter where it's located code-wise.
    Is that feasible?
    Only positioned elements can have a z-index applied which means that for static elements you can simply add position:relative without co-ordinates to create a local stacking context and have z-index take effect.

    If all elements on the page were not nested then simply setting the element you want to have the highest z-index would work.

    However things are never as simple as that If the elements are nested then their overall level on the page will be determined by their parents z-index and not their own.

    So to ensure an element remains on top then you would need to also ensure that the parent containing block's z-index is also higher than the other elements on the page.

    (Note that IE does have some bugs with z-index in anything but normal situations.)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •