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!
Who is Participating?
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;
Brad Dobyns, CSMScrumMasterCommented:
Or something like this:

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

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.