Box Decoration Break
Tailwind CSS version
v2.1+
Utilities for controlling how element fragments should be rendered across multiple lines, columns, or pages.
Default class reference
Class | Properties |
---|---|
decoration-slice | box-decoration-break: slice; |
decoration-clone | box-decoration-break: clone; |
Usage
Use the decoration-slice
and decoration-clone
utilities to control whether properties like background, border, border-image, box-shadow, clip-page, margin, and padding should be rendered as if the element were one continuous fragment, or distinct blocks.
<span class="decoration-clone bg-gradient-to-b from-yellow-400 to-red-500 text-transparent ...">
Hello<br>
World
</span>
Responsive
To control the box-decoration-break property at a specific breakpoint, add a {screen}:
prefix to any existing box-decoration-break utility. For example, use md:decoration-slice
to apply the decoration-slice
utility at only medium screen sizes and above.
<div class="decoration-clone md:decoration-slice ...">
<!-- ... -->
</div>
For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.
Customizing
Variants
By default, only responsive variants are generated for box-decoration-break utilities.
You can control which variants are generated for the box-decoration-break utilities by modifying the boxDecorationBreak
property in the variants
section of your tailwind.config.js
file.
For example, this config will also generate hover and focus variants:
// tailwind.config.js
module.exports = {
variants: {
extend: {
// ...
+ boxDecorationBreak: ['hover', 'focus'],
}
}
}
Disabling
If you don’t plan to use the box-decoration-break utilities in your project, you can disable them entirely by setting the boxDecorationBreak
property to false
in the corePlugins
section of your config file:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ boxDecorationBreak: false,
}
}