• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1442
  • Last Modified:

Infinite z-index - Element always on top

How can I tell an element to have an infinite z-index?

For example, if I have two divs:

<div id="top">Always on top</div>

<div id="bottom">Always on bottom</div>

How can I tell the top div to *always* have a higher z-index?

Thank you!
0
lightmatrix
Asked:
lightmatrix
  • 3
1 Solution
 
Brad Dobyns, CSMScrumMasterCommented:
There is no such thing as an infinite z-index. However, z-index only works if you set the position of your div to relative or absolute.

You could do this:

#top {
position: relative;
z-index: 999;
}
0
 
Brad Dobyns, CSMScrumMasterCommented:
Or something like this:

top.zIndex = 999;
0
 
Brad Dobyns, CSMScrumMasterCommented:
Did this solution work? I have not heard from you.

Thanks,
Brad
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now