定位与z-index

说起position这个东西,就不得不说z-index 属性, 说起z-index就不得不说层叠上下文

嗯……好复杂

参考

http://www.zhangxinxu.com/wordpress/2016/01/understand-css-stacking-context-order-z-index/

https://developer.mozilla.org/zh-CN/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context

https://developer.mozilla.org/zh-CN/docs/Web/Guide/CSS/Understanding_z_index

https://www.w3.org/TR/CSS21/zindex.html

transform 对position fixed的影响

使用transform 属性值不为’none’的元素会生成层叠上下文, 而z-index 对层叠水平的影响只有在当前层叠上下文元素中才有意义。因此什么position: fixed; z-index:9999 这种操作直接就跪了(ㄒoㄒ)

transform 还会在某些chrome 版本或360浏览器中使position: fixed absolute化,也就是说position: fixed; right: 0 这种操作和 postition: absolute; right: 0; 一个样子

所以这两个东西属性怕是最好不要一起用,会很头痛