Utilities for controlling how element fragments should be rendered across multiple lines, columns, or pages.
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>
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.
默认情况下, 针对 box-decoration-break 功能类,只生成 responsive 变体。
您可以通过修改您的 tailwind.config.js
文件中的 variants
部分中的 boxDecorationBreak
属性来控制为 box-decoration-break 功能生成哪些变体。
例如,这个配置也将生成 hover and focus 变体:
// tailwind.config.js
module.exports = {
variants: {
extend: {
// ...
+ boxDecorationBreak: ['hover', 'focus'],
}
}
}
如果您不打算在您的项目中使用 box-decoration-break 功能,您可以通过在配置文件的 corePlugins
部分将 boxDecorationBreak
property to false
in the corePlugins
section of your config file:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ boxDecorationBreak: false,
}
}