Last updated: 8 May 2024

Tailwind CSS Text Decoration Thickness

The text-decoration-thickness utility class in Tailwind CSS allows you to control the thickness of text decorations such as underline, overline, and line-through.


Tailwind Text Decoration Thickness

The text-decoration-thickness utility class in Tailwind CSS allows you to control the thickness of text decorations such as underline, overline, and line-through. With Tailwind's text-decoration-thickness class, you can easily adjust the thickness of these text decorations.

Applying Text Decoration Thickness

To apply text decoration thickness to an element, you can use the decoration-{width} utility class, where {width} represents the desired thickness value. Here are the some available thickness options:

  • decoration-auto: Applies the default thickness of the text decoration (default).
  • decoration-0: Applies a thin thickness to the text decoration.
  • decoration-8: Applies a thick thickness to the text decoration.
html
<p class="decoration-4 underline">
This is an underlined text with a 4px thickness.
</p>
<p class="decoration-2 underline">
This is an underlined text with a decoration thickness of 2px.
</p>

Preview

This is an underlined text with a 4px thickness.

This is an underlined text with a decoration thickness of 2px.

Responsive Text Decoration Thickness

Tailwind CSS allows you to apply text decoration thickness classes responsively at different breakpoints. To use responsive text decoration thickness classes, you can append the breakpoint prefix to the utility class. For example, md:decoration-1 applies a thin thickness to the text decoration starting from the medium breakpoint and above.

html
<p class="decoration-4 md:decoration-1 underline">
This text has a thick underline by default, but the thickness changes to thin on medium screens
and above.
</p>

In the above example, the text has a thick underline by default (decoration-4), but starting from the medium breakpoint and above, the thickness changes to thin (md:decoration-2).

Tailwind Text Decoration Thickness Class Table

ClassProperties
decoration-autotext-decoration-thickness: auto;
decoration-from-fonttext-decoration-thickness: from-font;
decoration-0text-decoration-thickness: 0px;
decoration-1 text-decoration-thickness: 1px;
decoration-2 text-decoration-thickness: 2px;
decoration-4 text-decoration-thickness: 4px;
decoration-8 text-decoration-thickness: 8px;

Windframe Tailwind Blocks

Landing page

Windframe is a drag and drop builder for rapidly building tailwind css websites and UIs

Start building stunning tailwind UIs! 

Build from scratch or select prebuilt tailwind templates