Skip to main content

Z-Index

Set the stack order for an element.

View as Markdown
baselinewidely
ClassCSS
zi:0z-index: 0;
zi:10z-index: 10;
zi:20z-index: 20;
zi:30z-index: 30;
zi:40z-index: 40;
zi:50z-index: 50;
zi:60z-index: 60;
zi:70z-index: 70;
zi:80z-index: 80;
zi:90z-index: 90;
zi:9999z-index: 9999;
zi:autoz-index: auto;

Variants

Prefix any class with a variant to apply it only under that condition. Variants stack, as in @md:h:zi:60.

Breakpoints

Apply a class from a viewport width up. Each breakpoint covers its width & every width above it.

@xs:zi:60From 32rem up.
@sm:zi:60From 40rem up.
@md:zi:60From 48rem up.
@lg:zi:60From 64rem up.
@xl:zi:60From 80rem up.
@xxl:zi:60From 96rem up.

Containers

Apply a class from a container's width up, not the viewport's. Mark the parent with ct:is first.

@c:xs:zi:60Container from 32rem up.
@c:sm:zi:60Container from 40rem up.
@c:md:zi:60Container from 48rem up.
@c:lg:zi:60Container from 64rem up.
@c:xl:zi:60Container from 80rem up.
@c:xxl:zi:60Container from 96rem up.

Media

Apply a class when the device or the page matches a condition, or on the first frame an element renders.

@pc:zi:60On a touch screen.
@prm:zi:60With reduced motion on.
@st:zi:60On the first frame.

States

Apply a class only while the element is in a state, such as hovered, focused or checked.

h:zi:60On :hover.
f:zi:60On :focus.
fv:zi:60On :focus-visible.
a:zi:60On :active.
d:zi:60On :disabled.
fc:zi:60On :first-child.
c:zi:60On :checked.
e:zi:60On :empty.
fw:zi:60On :focus-within.
i:zi:60On :invalid.
in:zi:60On :indeterminate.
lc:zi:60On :last-child.
nc:zi:60On :nth-child.
r:zi:60On :required.
ro:zi:60On :read-only.
v:zi:60On :valid.

Pseudo Elements

Style a part of the element rather than the element itself, such as its placeholder or the selected text.

a::zi:60On ::after.
b::zi:60On ::before.
p::zi:60On ::placeholder.
s::zi:60On ::selection.

Negative

Put a minus after the colon to negate a value.

zi:-10A minus after the colon.