Quick reference

Class
Properties
box-decoration-clonebox-decoration-break: clone;
box-decoration-slicebox-decoration-break: slice;

Basic usage

Setting the box decoration break

Use the box-decoration-slice and box-decoration-clone utilities to control whether properties like background, border, border-image, box-shadow, clip-path, margin, and padding should be rendered as if the element were one continuous fragment, or distinct blocks.

box-decoration-slice

Hello
World

box-decoration-clone

Hello
World
<span class="box-decoration-slice bg-gradient-to-r from-indigo-600 to-pink-500 text-white px-2 ...">
  Hello<br />
  World
</span>
<span class="box-decoration-clone bg-gradient-to-r from-indigo-600 to-pink-500 text-white px-2 ...">
  Hello<br />
  World
</span>

Applying conditionally

Hover, focus, and other states

Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:box-decoration-slice to only apply the box-decoration-slice utility on hover.

<div class="box-decoration-clone hover:box-decoration-slice">
  <!-- ... -->
</div>

For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.

Breakpoints and media queries

You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:box-decoration-slice to apply the box-decoration-slice utility at only medium screen sizes and above.

<div class="box-decoration-clone md:box-decoration-slice">
  <!-- ... -->
</div>

To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.