Lzh on GitHub

text-decoration-thickness

用于控制文本装饰粗细的工具。

快速参考

类别样式
decoration-<number>text-decoration-thickness: <number>px;
decoration-from-fonttext-decoration-thickness: from-font;
decoration-autotext-decoration-thickness: auto;
decoration-(length:<custom-property>)text-decoration-thickness: var(<custom-property>);
decoration-<value>text-decoration-thickness: <value>;

示例

基本示例

使用 decoration-<number> 工具(例如 decoration-2decoration-4)来改变元素的 文本装饰 粗细:

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>

使用自定义值

使用 decoration-[<value>] 语法来基于完全自定义的值设置 文本装饰粗细

<p class="decoration-[0.25rem] ...">
  Lorem ipsum dolor sit amet...
</p>

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

<p class="decoration-(length:--my-decoration-thickness) ...">
  Lorem ipsum dolor sit amet...
</p>

这只是 decoration-[length:var(<custom-property>)] 的一个简写形式,它会自动为你添加 var() 函数。

响应式设计

text-decoration-thickness 工具前加上像 md: 这样的断点变体,以便只在中等屏幕尺寸及以上应用该工具:

<p class="underline md:decoration-4 ...">
  Lorem ipsum dolor sit amet...
</p>

变体文档 中了解更多关于使用变体的信息。