1. 排版
  2. text-decoration-thickness

排版

text-decoration-thickness

用于控制文本装饰厚度的工具。

样式
decoration-<number>
text-decoration-thickness: <number>px;
decoration-from-font
text-decoration-thickness: from-font;
decoration-auto
text-decoration-thickness: auto;
decoration-(<custom-property>)
text-decoration-thickness: var(<custom-property>);
decoration-[<value>]
text-decoration-thickness: <value>;

示例(Examples)

¥Examples

基本示例(Basic example)

¥Basic example

使用 decoration-<number> 工具(如 decoration-2decoration-4)更改元素的 文本修饰 厚度:

¥Use decoration-<number> utilities like decoration-2 and decoration-4 to change the text decoration thickness of an element:

decoration-1

The quick brown fox jumps over the lazy dog.

decoration-2

The quick brown fox jumps over the lazy dog.

decoration-4

The quick brown fox jumps over the lazy dog.

<p class="underline decoration-1">The quick brown fox...</p>
<p class="underline decoration-2">The quick brown fox...</p>
<p class="underline decoration-4">The quick brown fox...</p>

使用自定义值(Using a custom value)

¥Using a custom value

使用 decoration-[<value>] 语法 根据完全自定义的值设置 text decoration thickness

<p class="decoration-[0.25rem] ...">
<!-- ... -->
</p>

对于 CSS 变量,还可以使用 decoration-(<custom-property>) 语法:

<p class="decoration-(--my-decoration-thickness) ...">
<!-- ... -->
</p>

这只是简写,用于 decoration-[var(<custom-property>)] 它会自动为你添加 var() 函数。

响应式设计(Responsive design)

¥Responsive design

text-decoration-thickness 工具前面使用断点变体如 md: 仅在 medium 屏幕尺寸及以上时应用工具:

<p class="underline md:decoration-4 ...">
<!-- ... -->
</p>

请参阅 变体文档 详细了解如何使用变体。

TailwindCSS v4.0 中文网 - 粤ICP备13048890号