The problem with z-index is that very few people understand how it really works. It’s not complicated, but it if you’ve never taken the time to read its specification, there are almost certainly crucial aspects that you’re completely unaware of.
This is a terrific article to read if you ever write a line of CSS.
z-index is so often utilized to accomplish a number of complex design implementation tasks, but I’d be willing to bet that quite a bit of trial and error is attempted in order to achieve the goal. Further, I bet that ‘trial and error’ pretty much consists of adding another 9 to the z-index until it works, and when it doesn’t you end up rewriting the HTML so it does. We’ve all been there.
Have a read through this article and I’m willing to bet you’ll learn a couple things about how
z-index operates, and from then on you won’t need to get frustrated when it doesn’t do what you want it to do.