Text Decoration Style 文本装饰样式
控制文本装饰样式的实用工具。
| Class | Properties |
|---|
基本用法
设置文本装饰样式
使用 decoration-{style} 实用工具来改变元素的文本装饰样式。
decoration-solid
The quick brown fox jumps over the lazy dog.
decoration-double
The quick brown fox jumps over the lazy dog.
decoration-dotted
The quick brown fox jumps over the lazy dog.
decoration-dashed
The quick brown fox jumps over the lazy dog.
decoration-wavy
The quick brown fox jumps over the lazy dog.
html
<p class="underline decoration-solid ...">The quick brown fox...</p>
<p class="underline decoration-double ...">The quick brown fox...</p>
<p class="underline decoration-dotted ...">The quick brown fox...</p>
<p class="underline decoration-dashed ...">The quick brown fox...</p>
<p class="underline decoration-wavy ...">The quick brown fox...</p>有条件地应用
悬停、焦点和其他状态
Tailwind 允许您使用变体修饰符在不同状态下有条件地应用实用程序类。例如,使用 hover:decoration-dashed 只在悬停时应用 decoration-dashed 实用程序。
html
<p class="underline hover:decoration-dashed">
<!-- ... -->
</p>有关所有可用状态修改器的完整列表,请查看悬停、焦点和其他状态文档。
断点和媒体查询
您还可以使用变体修饰符来针对响应式断点、深色模式、prefers-reduced-motion 等媒体查询进行定位。例如,使用 md:decoration-dashed 仅在中等屏幕尺寸及以上应用 decoration-dashed 实用程序。
html
<p class="underline md:decoration-dashed">
<!-- ... -->
</p>