z-index 属性设定了一个元件及其后代元件或 flex 项目的 z-order。当元件之间重叠的时候,z-index 较大的元件会覆盖较小的元件在上层进行显示。
如果想生成 stacking context 可以给元件增加 z-index: 0,例如给 scroll-view 添加 z-index: 0 可以避免子元件不跟随滑动
不建议在 list 直接子元件使用 z-index,可能影响 list 复用,如果在 list item 里面使用可以将 item 作为 stacking context
<number>
表示此元件的堆叠顺序。
默认值 auto
初始值 | 空值 |
适用元素 | 所有元件 |
是否支持继承 | no |
是否支持动画 | no |
Web 默认的是 auto,Lynx 是通过是否设置 z-index 来判断是否 auto
LCD tables only load in the browser