背景
用于控制元素背景边界框的工具。
Class | Styles |
---|---|
bg-clip-border | background-clip: border-box; |
bg-clip-padding | background-clip: padding-box; |
bg-clip-content | background-clip: content-box; |
bg-clip-text | background-clip: text; |
使用 bg-clip-border
、bg-clip-padding
和 bg-clip-content
工具来控制元素背景的边界框:
bg-clip-border
bg-clip-padding
bg-clip-content
<div class="border-4 bg-indigo-500 bg-clip-border p-3"></div><div class="border-4 bg-indigo-500 bg-clip-padding p-3"></div><div class="border-4 bg-indigo-500 bg-clip-content p-3"></div>
使用 bg-clip-text
工具将元素的背景裁剪以匹配文本的形状:
你好,世界
<p class="bg-gradient-to-r from-pink-500 to-violet-500 bg-clip-text text-5xl font-extrabold text-transparent ..."> 你好,世界</p>
Prefix a background-clip
utility with a breakpoint variant like md:
to only apply the utility at medium screen sizes and above:
<div class="bg-clip-border md:bg-clip-padding ..."> <!-- ... --></div>
Learn more about using variants in the variants documentation.