how to use z-index with relative positioning?
When you set position: relative on an element then you establish a new containing block. All positioning inside that block is with respect to it. Setting z-index on an element inside that block will only alter its layer with respect to other elements inside the same block. I’m not aware of any work-arounds.