box-decoration-break

Class Description

box-decoration-slice

Sets box decoration break to slice, applying backgrounds and borders across the whole element as if it were not fragmented.

CSS Rules

.box-decoration-slice {
  -webkit-box-decoration-break: slice;
  box-decoration-break: slice;
}

Usage

<element class="box-decoration-slice" />

Responsive

Prefix .box-decoration-slice utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:box-decoration-slice" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="box-decoration-slice:hover" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="box-decoration-slice:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before box-decoration-slice::before" />

<element class="content-after box-decoration-slice::after" />
.box-decoration-slice Sets box decoration break to slice, applying backgrounds and borders across the whole element as if it were not fragmented.

box-decoration-clone

Sets box decoration break to clone, rendering backgrounds and borders for each individual fragment.

CSS Rules

.box-decoration-clone {
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

Usage

<element class="box-decoration-clone" />

Responsive

Prefix .box-decoration-clone utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:box-decoration-clone" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="box-decoration-clone:hover" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="box-decoration-clone:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before box-decoration-clone::before" />

<element class="content-after box-decoration-clone::after" />
.box-decoration-clone Sets box decoration break to clone, rendering backgrounds and borders for each individual fragment.