Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS 小记(z-index、层叠上下文) #8

Open
afishhhhh opened this issue Aug 18, 2020 · 0 comments
Open

CSS 小记(z-index、层叠上下文) #8

afishhhhh opened this issue Aug 18, 2020 · 0 comments

Comments

@afishhhhh
Copy link
Owner

afishhhhh commented Aug 18, 2020

  1. 设置了 position 且值不是 static 的元素,z-index 会生效,无论是显示设置还是隐式 auto
  2. position: sticky 时,该元素会直接产生层叠上下文。
  3. display: flex 的子元素,即便 position: staticz-index 也会生效,它的表现相当于 position: relative
  4. 设置了 z-index 为数值时,该元素会产生层叠上下文,auto 不会产生层叠上下文。
  5. 层叠等级的比较只有在同一个层叠上下文中才有意义,内层的层叠上下文和所有子元素都受制于外层的层叠上下文,如果外层的层叠上下文拥有更高的等级,则其内部元素自动拥有更高的等级。
  6. 父级层叠上下文并不一定就是其直接父元素。
  7. html 产生一个根层叠上下文。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant