Daily-Question icon indicating copy to clipboard operation
Daily-Question copied to clipboard

【Q564】z-index: 999 元素一定会置于 z-index: 0 元素之上吗

Open shfshanyue opened this issue 3 years ago • 3 comments

shfshanyue avatar Jun 01 '21 00:06 shfshanyue

代码见 zindex - codepen

不一定,更复杂的示例见 层叠上下文 - MDN

shfshanyue avatar Jun 01 '21 00:06 shfshanyue

不一定 需要考虑到是否在同一个元素层级中 不然z-index的值有限制

sisipyhus avatar Feb 22 '23 08:02 sisipyhus

z-index高数值不一定在低数值前面,因为有层叠上下文的概念。当处于两个兄弟层叠上下文时,子元素的层级显示不决定于自身的z-index,而取决于父级的z-index

Minf97 avatar Sep 25 '23 01:09 Minf97