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.
Interactive Text Decoration Playground
Try each class live and inspect the CSS output.
Preview text
underlinetext-decoration-line: underline;Text decoration in Tailwind goes way beyond slapping underlines on links. You can control the decoration type (underline, strikethrough, wavy lines), color, thickness, style, and offset. Most developers stop at underline and line-through, but there's a lot more you can do once you know the full system.
How to apply Tailwind Text Decoration
Start here before getting fancy:
underline- Links in body text, emphasized contentline-through- Original prices, deleted content, completed tasksoverline- Almost never (decorative headings occasionally)no-underline- Navigation links, removing default link styles
The overline utility exists but I've maybe used it five times ever. It's one of those things that sounds useful but rarely fits real designs.
1<p class="underline">This is an underlined text.</p>2<p class="overline">This is an overline text.</p>3<p class="line-through">This is a text with line through .</p>4<p class="no-underline">This is a text with no underline.</p>
This is a text with line through .
This is a text with no underline.
Decoration Style (Wavy Lines and More)
Your decoration doesn't have to be solid:
1<p class="underline decoration-solid">Solid (default)</p>2<p class="underline decoration-double">Double line</p>3<p class="underline decoration-dotted">Dotted line</p>4<p class="underline decoration-dashed">Dashed line</p>5<p class="underline decoration-wavy decoration-red-500">Wavy red line</p>
Wavy underlines are perfect for:
- Fake spell-check UI
- Highlighting errors or warnings
- Playful designs
1<p class="text-gray-800">2 The word <span class="underline decoration-wavy decoration-red-500">recieve</span>3 is misspelled.4</p>
The word recieve is misspelled.
Double underlines work for legal docs or formal emphasis. Dotted/dashed indicate external links or provisional content.
Decoration Thickness
Control how thick the line appears:
1<p class="underline decoration-1">Thin (1px)</p>2<p class="underline decoration-2">Medium (2px)</p>3<p class="underline decoration-4">Thick (4px)</p>4<p class="underline decoration-8">Very thick (8px)</p>
Thick underlines on headings create visual impact:
1<h1 class="text-5xl font-bold underline decoration-blue-500 decoration-8 underline-offset-8">2 Bold Statement3</h1>
Bold Statement
For body links, stick to decoration-1 or decoration-2. Thicker lines look weird at small sizes.
Underline Offset (Fix Descender Clipping)
Controls the gap between text and underline:
1<p class="text-2xl underline underline-offset-2">Close to text</p>2<p class="text-2xl underline underline-offset-4">Medium gap</p>3<p class="text-2xl underline underline-offset-8">Large gap</p>
The problem: letters like g, j, p, q, y have descenders that hang below the baseline. If your underline is too close, it clips through them:
1<!-- Bad - underline cuts through letters -->2<p class="text-3xl underline underline-offset-1">3 Typography problems4</p>56<!-- Fixed -->7<p class="text-3xl underline underline-offset-4">8 Typography problems9</p>
Typography problems
Typography problems
My rule:
- Small text:
underline-offset-2orunderline-offset-4 - Large text:
underline-offset-4orunderline-offset-8
Hover States
Text decoration shines in interactive states:
1<!-- Reveal underline on hover -->2<a href="#" class="no-underline hover:underline">3 Hover to reveal4</a>56<!-- Hide underline on hover -->7<a href="#" class="underline hover:no-underline">8 Hover to hide9</a>1011<!-- Change color on hover -->12<a href="#" class="underline decoration-gray-300 hover:decoration-blue-600">13 Color transition14</a>1516<!-- Thicken on hover -->17<a href="#" class="underline decoration-2 hover:decoration-4 transition-all">18 Gets thicker19</a>
Responsive Decoration
Change decoration at different screen sizes:
1<!-- Underline on mobile, clean on desktop -->2<a href="#" class="underline md:no-underline hover:underline">3 Mobile-friendly nav link4</a>56<!-- Adjust thickness responsively -->7<h2 class="underline decoration-2 md:decoration-4 lg:decoration-8">8 Scales with breakpoint9</h2>
Mobile-friendly nav link
Scales with breakpoint
I use mobile underlines in navigation. On small screens, underlines clarify what's clickable. On desktop, hover states are enough.
Real Examples
Strikethrough Prices
1<div class="flex items-center gap-3">2 <span class="text-2xl font-bold">$29.99</span>3 <span class="text-xl line-through decoration-red-500 text-gray-500">4 $49.995 </span>6 <span class="bg-red-100 text-red-700 text-sm px-2 py-1 rounded font-semibold">7 40% OFF8 </span>9</div>
$49.99
40% OFF
Red strikethrough makes the discount obvious.
Todo Completion
1<ul class="space-y-2">2 <li class="flex items-center gap-2">3 <input type="checkbox" checked />4 <span class="line-through text-gray-400">Finish project</span>5 </li>6 <li class="flex items-center gap-2">7 <input type="checkbox" />8 <span>Review code</span>9 </li>10</ul>
- Finish project
- Review code
Completed items fade and get crossed off.
Navigation Links
1<nav class="flex gap-6">2 <a href="#" class="no-underline hover:underline font-medium">Home</a>3 <a href="#" class="no-underline hover:underline font-medium">About</a>4 <a href="#" class="no-underline hover:underline font-medium">Contact</a>5</nav>
Clean until hover. Works for headers, footers, sidebars.
Accent Heading
``html
Featured Products
<div class="rounded-xl overflow-auto bg-gray-100 p-8">
<h2 class="text-4xl font-bold inline-block underline decoration-blue-500 decoration-4 underline-offset-8">
Featured Products
</h2>
</div>
Thick colored underline adds visual weight without extra markup.
## External Link Indicator
```html
<p>
Read the
<a href="https://example.com" class="text-blue-600 underline decoration-dotted hover:decoration-solid">
full documentation
</a>
for details.
</p>
Dotted underline signals external links, switches to solid on hover.
Spell Check UI
1<p class="text-gray-800">2 Please ensure you3 <span class="underline decoration-wavy decoration-red-500">recieve</span>4 our confirmation email.5</p>
Please ensure you recieve our confirmation email.
Wavy red underlines mimic native spell-check.
Common Mistakes
- Too Much Offset on Small Text
1<!-- Looks broken -->2<p class="text-sm underline underline-offset-8">3 Gap is too big4</p>
Scale offset with font size. Large offsets on small text look like a rendering bug.
- Forgetting Descenders
1<!-- Underline clips through letters -->2<h1 class="text-5xl underline underline-offset-1">Typography</h1>
Test with words containing g, j, p, q, y. Increase offset if they clash.
- Low Contrast Decoration
1<!-- Hard to see -->2<div class="bg-blue-500">3 <a href="#" class="text-white underline decoration-blue-400">4 Low contrast5 </a>6</div>78<!-- Better -->9<div class="bg-blue-500">10 <a href="#" class="text-white underline decoration-white">11 High contrast12 </a>13</div>
Decoration needs contrast with its background, not just the text.
- Hover Layout Shift
1<!-- Jumps on hover - underline adds space -->2<a href="#" class="no-underline hover:underline">Jumpy</a>34<!-- Smooth - underline always there, just transparent -->5<a href="#" class="underline decoration-transparent hover:decoration-current">6 Smooth7</a>
Use transparent decoration instead of toggling to avoid layout shift.
- Over-decorating: Pick one decoration type. Two if you really know what you're doing. Three is visual noise.
When NOT to Use Decoration
Don't rely on decoration for:
- Important content (some assistive tech ignores it)
- Anything users need to copy/paste (decoration doesn't copy)
- Interactive elements beyond links (buttons should look like buttons)
- Critical information (combine with semantic HTML)
Conclusion
Most people stop at underline and line-through, missing out on color, thickness, style, and offset controls. These utilities solve real design problems, from subtle link styling to strikethrough prices to spell-check UI. Start with the basics (underline, line-through), then layer in color and hover states. Once you're comfortable, experiment with thickness, offset, and wavy styles. And remember: decoration is visual enhancement. If the content matters semantically (deletions, insertions, emphasis), use proper HTML elements with Tailwind styling on top.
Tailwind Text decoration Class Table
| Class | Properties |
|---|---|
| underline | text-decoration: underline; |
| line-through | text-decoration: line-through; |
| no-underline | text-decoration: none; |
Worth Reading
-
MDN: text-decoration - CSS fundamentals
Windframe Tailwind blocks
Windframe is an AI visual editor for rapidly building stunning web UIs & websites
Start building stunning web UIs & websites!

