text-decoration-thickness

Các tiện ích để kiểm soát độ dày của text decoration.

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

Ví dụ

Ví dụ cơ bản

Sử dụng các tiện ích decoration-<number> như decoration-2decoration-4 để thay đổi độ dày của text decoration của một phần tử:

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>

Sử dụng giá trị tùy chỉnh

Use the decoration-[<value>] syntax to set the text decoration thickness based on a completely custom value:

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

For CSS variables, you can also use the decoration-(length:<custom-property>) syntax:

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

This is just a shorthand for decoration-[length:var(<custom-property>)] that adds the var() function for you automatically.

Responsive design

Prefix a text-decoration-thickness utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:

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

Learn more about using variants in the variants documentation.

Copyright © 2025 Tailwind Labs Inc.·Chính sách thương hiệu