Solution to invalid z-index in css

z-index must be used in conjunction with position:relative/absolute. otherwise invalid

The gray is the mask, it should be overlaid on the button to claim immediately, but now it is obviously the opposite.

Because the default value of position is static. The browser will determine the position of each element in the order of the source code, which is called "normal page flow". The element position caused by static positioning is determined by the browser itself, and the top, right, bottom, left and z-index attributes will be ignored

So when using z-index, you need to change the default value of position.

Guess you like

Origin blog.csdn.net/qq_56715703/article/details/131093116