diff options
| author | Bobby <[email protected]> | 2024-08-16 20:47:33 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-08-16 20:47:33 -0400 |
| commit | 6b28433d9cfde435be8ec2bd6cf91e6324d08865 (patch) | |
| tree | 8343c27b8b95ff5639233e81cf157f92e5688466 /site/content/docs/5.3/utilities/z-index.md | |
| parent | d53094ec16ba385faae2973ddee648698b32ab24 (diff) | |
| parent | 048f56f51460df75e92a2f7b472e1c56baeb68f7 (diff) | |
| download | bootstrap-main.tar.xz bootstrap-main.zip | |
Diffstat (limited to 'site/content/docs/5.3/utilities/z-index.md')
| -rw-r--r-- | site/content/docs/5.3/utilities/z-index.md | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/site/content/docs/5.3/utilities/z-index.md b/site/content/docs/5.3/utilities/z-index.md new file mode 100644 index 000000000..80b8dba92 --- /dev/null +++ b/site/content/docs/5.3/utilities/z-index.md @@ -0,0 +1,51 @@ +--- +layout: docs +title: Z-index +description: Use our low-level `z-index` utilities to quickly change the stack level of an element or component. +group: utilities +toc: true +added: + version: "5.3" +--- + +## Example + +Use `z-index` utilities to stack elements on top of one another. Requires a `position` value other than `static`, which can be set with custom styles or using our [position utilities]({{< docsref "/utilities/position/" >}}). + +{{< callout >}} +We call these "low-level" `z-index` utilities because of their default values of `-1` through `3`, which we use for the layout of overlapping components. High-level `z-index` values are used for overlay components like modals and tooltips. +{{< /callout >}} + +{{< example class="bd-example-zindex-levels position-relative" >}} +<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> +{{< /example >}} + +## Overlays + +Bootstrap overlay components—dropdown, modal, offcanvas, popover, toast, and tooltip—all have their own `z-index` values to ensure a usable experience with competing "layers" of an interface. + +Read about them in the [`z-index` layout page]({{< docsref "/layout/z-index" >}}). + +## Component approach + +On some components, we use our low-level `z-index` values to manage repeating elements that overlap one another (like buttons in a button group or items in a list group). + +Learn about our [`z-index` approach]({{< docsref "/extend/approach#z-index-scales" >}}). + +## CSS + +### Sass maps + +Customize this Sass map to change the available values and generated utilities. + +{{< scss-docs name="zindex-levels-map" file="scss/_variables.scss" >}} + +### Sass utilities API + +Position utilities are declared in our utilities API in `scss/_utilities.scss`. [Learn how to use the utilities API.]({{< docsref "/utilities/api#using-the-api" >}}) + +{{< scss-docs name="utils-zindex" file="scss/_utilities.scss" >}} |
