Linkjuice57 Linkjuice57 - 1 year ago 82
HTML Question

Why does z-index not work?

So if I understand

correctly, it would be perfect in this situation:

enter image description here

I want to place the bottom image (the tag/card) below the div above it. So you can't see the sharp edges. How do I do this?

z-index:-1 // on the image tag/card


z-index:100 // on the div above

doesn't work either. Neither does a combination of anything like this. How come?

Answer Source

z-index only works on positioned elements (position:absolute, position:relative, or position:fixed).

Edit by TylerH:

There is also position: sticky; that is supported in Firefox, is prefixed in Safari, worked for a time in older versions of Chrome under a custom flag, and is under consideration by Microsoft to add to their Edge browser.