本文介绍了哪些CSS属性创建堆叠上下文?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在研究堆叠上下文,并使用 我做了几个测试,发现除了 a href =http://www.w3.org/TR/css3-transforms>转换元素: 设置 转换 到 none 。 设置 transform-style 到 preserve-3d 。 设置 透视 到 none 。 创建 CSS区域:设置 流出 content 是除正常之外的任何 none code>。 在分页媒体,每个页边距框都会建立自己的堆叠上下文。 在过滤器效果中,将 过滤器 到无。 在合成和混合,请设置 隔离 到隔离。 在将更改,设置 code> will-change 到其任何非初始值将创建堆叠上下文的属性。 请注意,块格式化上下文不是与堆叠上下文相同;实际上,它们是两个完全独立的(虽然不是互斥的)概念。 for its descendants:The root element always holds a root stacking context. This is why you can start arranging elements without having to position the root element first. Any element that doesn't already participate in a local stacking context (generated by any of the other scenarios below) will participate in the root stacking context instead.Setting z-index to anything other than auto on an element that is positioned (i.e. an element with position that isn't static).Note that this behavior is slated to be changed for elements with position: fixed such that they will always establish stacking contexts regardless of their z-index value. Some browsers have begun to adopt this behavior, however the change has not been reflected in either CSS2.1 or the new CSS Positioned Layout Module yet, so it may not be wise to rely on this behavior for now.This change in behavior is explored in another answer of mine, which in turn links to this article and this set of CSSWG telecon minutes.Another exception to this is with a flex item. Setting z-index on a flex item will always cause it to establish a stacking context even if it isn't positioned.Setting opacity to anything less than 1.Transforming the element:Setting transform to anything other than none.Setting transform-style to preserve-3d.Setting perspective to anything other than none.Creating a CSS region: setting flow-from to anything other than none on an element whose content is anything other than normal.In paged media, each page-margin box establishes its own stacking context.In filter effects, setting filter to anything other than none.In compositing and blending, setting isolation to isolate.In will change, setting will-change to a property whose any non-initial value would create a stacking context.Note that a block formatting context is not the same as a stacking context; in fact, they are two completely independent (although not mutually exclusive) concepts. This does not include pseudo-stacking contexts, an informal term that simply refers to things that behave like independent stacking contexts with respect to positioning, but actually participate in their parent stacking contexts. 这篇关于哪些CSS属性创建堆叠上下文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
05-27 13:01
查看更多