Tailwind CSS Text Decoration

The text-decoration utility class in Tailwind CSS allows you to add visual styles to text decorations such as underline, overline, line-through, and more. With Tailwind's text-decoration class, you can easily enhance the appearance of text elements.

Applying Text Decoration

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

  • text-underline: Adds an underline to the text.
  • text-overline: Adds a line above the text.
  • text-line-through: Adds a line through the text.
  • text-no-underline: Removes any text decoration.
html
<p class="underline">
This is an underlined text.
</p>
<p class="overline">
This is an overline text.
</p>
<p class="line-through">
This is a text with line through .
</p>
<p class="no-underline">
This is a text with no underline.
</p>

Preview

This is an underlined text.
This is an overline text.
This is a text with line through .
This is a text with no underline.

Responsive Text Decoration

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

html
<p class="underline md:line-through">
This text is underlined by default, but has a line-through style on medium screens and above.
</p>

In the above example, the text is underlined by default (underline), but starting from the medium breakpoint and above, it has a line-through text decoration (md:line-through).

Tailwind Text decoration Class Table

ClassProperties
underlinetext-decoration: underline;
line-throughtext-decoration: line-through;
no-underlinetext-decoration: none;

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