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.
Tailwind 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.
<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.
<p class="underline md:line-through"> This text is underlined by default, but has a line-through style on medium screens and above.</p>
Preview
This text is underlined by default, but has a line-through style on medium screens and above.
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
Class | Properties |
---|---|
underline | text-decoration: underline; |
line-through | text-decoration: line-through; |
no-underline | text-decoration: none; |
Windframe Tailwind blocks
Windframe is a drag and drop builder for rapidly building tailwind css websites and UIs