Skip to content

18.z-index

不使用 z-index 堆叠顺序

  • 顺序规则:节点不设置 position, 后覆盖前
  • 定位规则:设置 positon: relative absolute fixed, 会覆盖没有设置 position 元素,或者属性值为 static 节点,
  • 参与规则:不设置 position 三个属性,直接设置属性 z-index, 是不生效的
  • 默认规则:都设置了 position: realtive, z-index:0 和不设置 z-index 一样,靠后的在上
  • 从父原则:父 A 里的 A1 子设置 z-index 在高,都不会覆 B 里面设置 z-index 低 的 B1

https://www.cnblogs.com/GeniusLyzh/p/4621335.html

在 MIT 许可下发布