布局
用于控制应如何跨多行、多列或多页渲染元素片段的工具。
¥Basic usage
¥Setting the box decoration break
使用 box-decoration-slice
和 box-decoration-clone
工具来控制是否应将诸如背景、边框、边框图片、框阴影、剪辑路径、边距和填充等属性渲染为就好像该元素是一个连续片段或不同的块一样。
¥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
box-decoration-clone
<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>
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.
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.