Skip to content

Text Decoration 文本装饰

控制文本装饰的实用工具。

ClassProperties

基本用法

设置文本装饰

使用 underlineno-underlineline-through 实用程序控制文本的装饰。

underline

The quick brown fox jumps over the lazy dog.

overline

The quick brown fox jumps over the lazy dog.

line-through

The quick brown fox jumps over the lazy dog.

no-underline

The quick brown fox jumps over the lazy dog.

html
<p class="underline ...">The quick brown fox ...</p>
<p class="overline ...">The quick brown fox ...</p>
<p class="line-through ...">The quick brown fox ...</p>
<p class="no-underline ...">The quick brown fox ...</p>

有条件地应用

悬停、焦点和其他状态

Tailwind 允许您使用变体修饰符在不同状态下有条件地应用实用程序类。例如,使用 hover:underline 仅在悬停时应用 underline 实用程序。

👆 尝试将鼠标悬停在文本上,以查看预期的行为

html
<a href="#" class="no-underline hover:underline"></a>

有关所有可用状态修改器的完整列表,请查看悬停、焦点和其他状态文档。

断点和媒体查询

您还可以使用变体修饰符来针对响应式断点、深色模式、prefers-reduced-motion 等媒体查询进行定位。例如,使用 md:underline 仅在中等屏幕尺寸及以上应用 underline 实用程序。

html
<p class="no-underline md:underline">
  <!-- ... -->
</p>

要了解更多信息,请查看有关响应式设计深色模式其他媒体查询修饰符的文档。

Released under the MIT License.