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. 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-1text-decoration-thickness: 1px;
decoration-2text-decoration-thickness: 2px;
decoration-4text-decoration-thickness: 4px;
decoration-8text-decoration-thickness: 8px;

Windframe Tailwind Blocks

Landing page

Build modern projects using Bootstrap 5 and Contrast

Trying to create components and pages for a web app or website from scratch while maintaining a modern User interface can be very tedious. This is why we created Contrast, to help drastically reduce the amount of time we spend doing that. so we can focus on building some other aspects of the project.

Contrast Bootstrap PRO consists of a Premium UI Kit Library featuring over 10000+ component variants. Which even comes bundled together with its own admin template comprising of 5 admin dashboards and 23+ additional admin and multipurpose pages for building almost any type of website or web app.
See a demo and learn more about Contrast Bootstrap Pro by clicking here.

ad-banner