Skip to content

CSS Tutorial CSS Text

CSS Text Decoration

Lesson 44 of 182 2 min read By Deepak Paswan Updated Oct 4, 2026

text-decoration draws lines on text: underline, overline or line-through.

index.html
HTML
<style>
  .u { text-decoration: underline; }
  .o { text-decoration: overline; }
  .s { text-decoration: line-through; }
  .none { text-decoration: none; }
</style>
<p class="u">underline</p>
<p class="o">overline</p>
<p class="s">line-through (a crossed-out price)</p>
<p><a class="none" href="#">A link with its underline removed</a></p>

Fine control

The shorthand takes a line, a style, a color and a thickness, and you can also set them individually.

index.html
HTML
<style>
  a {
    color: #1a5276;
    text-decoration: underline wavy #d94a00;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
  }
</style>
<a href="#">A link with a wavy orange underline</a>
  • text-decoration-style: solid, dotted, dashed, double, wavy.
  • text-decoration-color and text-decoration-thickness.
  • text-underline-offset moves the underline away from the text so it stops cutting through letters with tails (g, y, p).

Many designs remove underlines from links. If you do, make sure links are still clearly different from the text around them, for example with a distinct color and a hover effect. Underlines are the most reliable way to tell people “this is clickable”. Styling Links goes further.

warning
Underlining things that are not links
Visitors expect underlined text to be clickable. For emphasis use font-weight or <em> instead.