使用我们的低级实用程序快速更改元素或组件的堆栈级别。z-index
例
使用实用程序将元素堆叠在一起。需要一个 以外的值,可以使用自定义样式或使用我们的位置实用程序进行设置。z-indexpositionstatic
我们称这些为“低级”实用程序,因为它们的默认值为 through,我们用它来布局重叠的组件。高级值用于叠加组件,如模式和工具提示。z-index-13z-index
Z-3
Z-2
Z-1
Z-0
Z-N1
<div class="z-3 position-absolute p-5 rounded-3"><span>z-3</span></div>
<div class="z-2 position-absolute p-5 rounded-3"><span>z-2</span></div>
<div class="z-1 position-absolute p-5 rounded-3"><span>z-1</span></div>
<div class="z-0 position-absolute p-5 rounded-3"><span>z-0</span></div>
<div class="z-n1 position-absolute p-5 rounded-3"><span>z-n1</span></div> 覆盖
Bootstrap 覆盖组件(下拉菜单、模式、画布外、弹出窗口、toast 和工具提示)都有自己的值,以确保界面的竞争“层”的可用体验。z-index
在 z-index 布局页面中阅读它们。
组件方法
在某些组件上,我们使用低级值来管理相互重叠的重复元素(例如按钮组中的按钮或列表组中的项目)。z-index
了解我们的 z 指数方法。
CSS系统
萨斯地图
自定义此 Sass 映射以更改可用值和生成的实用程序。
$zindex-levels: (
n1: -1,
0: 0,
1: 1,
2: 2,
3: 3
);
Sass 实用程序 API
位置实用程序在我们的实用程序 API 中声明。了解如何使用实用工具 API。scss/_utilities.scss
"z-index": (
property: z-index,
class: z,
values: $zindex-levels,
)

