position: fixed 时 z-index 失效

2020-05-11  本文已影响0人  Volcaner

position为fixed时设置z-index失效:

https://blog.csdn.net/acingdreamer/article/details/78561408

不受控制的 position:fixed:

https://www.cnblogs.com/coco1s/p/7358830.html

  1. z-index只有在设置了position为relative,absolute,fixed时才会有效。
  2. z-index的“从父原则”。当你发现把z-index设的多大都没用时,看看其父元素是否设置了有效的z-index,当然别忘了先看看自身是否设置了position。
上一篇下一篇

猜你喜欢

热点阅读