CSS text-decoration Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Typography

What You’ll Learn

The text-decoration property adds decorative lines to text — underlines, overlines, strike-throughs, and custom styled lines using shorthand syntax.

01

underline

Line below.

02

overline

Line above.

03

line-through

Strike text.

04

none

Remove lines.

05

Shorthand

Style + color.

06

Links

Common use case.

Introduction

The text-decoration property in CSS is used to set text formatting to underline, overline, line-through, or a combination of these styles.

It is a shorthand property for several sub-properties that let you control the appearance of decorative lines on text, including line type, style, color, and thickness.

Definition and Usage

Apply text-decoration to any element that contains text, such as paragraphs, links, headings, and spans.

Use none to remove default link underlines, underline for emphasis or links, and line-through for discounted prices or deleted content.

💡
Beginner Tip

Modern CSS lets you write shorthand like text-decoration: underline wavy red; to set the line, style, and color in one declaration.

📝 Syntax

The syntax for the text-decoration property is as follows:

syntax.css
element {
  text-decoration: value;
}

The value can be a keyword, a combination of line + style + color, or shorthand parts that control decoration appearance.

Basic Example

underline.css
a {
  text-decoration: underline;
}

Shorthand Example

wavy-underline.css
.highlight {
  text-decoration: underline wavy red;
}

Syntax Rules

  • Use none to remove all decoration lines.
  • Line keywords include underline, overline, and line-through.
  • Style keywords include solid, double, dotted, dashed, and wavy.
  • The property is not inherited, but links often look inherited because browsers apply default styles.

Related Properties

  • text-decoration-line — sets which lines appear
  • text-decoration-color — sets line color
  • text-decoration-style — sets line style
  • text-decoration-thickness — sets line thickness

🎯 Default Value

The default value of the text-decoration property is none, which means no decoration is applied to the text.

⚡ Quick Reference

QuestionAnswer
Default valuenone
Common line valuesunderline, overline, line-through
Shorthand exampleunderline wavy red
Remove link underlinetext-decoration: none;
InheritedNo
AnimatableColor only (in supporting browsers)

💎 Property Values

ValueExampleDescription
nonetext-decoration: none;Removes any text decoration.
underlinetext-decoration: underline;Adds an underline beneath the text.
overlinetext-decoration: overline;Adds a line above the text.
line-throughtext-decoration: line-through;Adds a line through the text.
blinktext-decoration: blink;Causes text to blink. Not widely supported and not recommended because it can distract users.

Shorthand Components

The shorthand can also include style, color, and thickness values:

ComponentWhat it controlsExample values
text-decoration-colorColor of the decoration linered, #2563eb
text-decoration-styleStyle of the decoration linesolid, double, dotted, dashed, wavy
text-decoration-thicknessThickness of the decoration lineauto, 2px, 0.1em
none underline overline line-through wavy red

When to Use text-decoration

text-decoration is useful whenever text needs a visual line treatment:

  • Links — Underline clickable text, or remove underlines for navigation menus.
  • Sale prices — Use line-through on old prices.
  • Emphasis — Add underlines or wavy lines to highlight terms.
  • Editorial styling — Create decorative heading or label treatments with overline or custom colors.

👀 Live Preview

Common text-decoration effects applied to sample text:

This text is underlined.
This text has an overline.
This text has a line through it.
This text has a wavy red underline.

Examples Gallery

Start with the reference underline, overline, line-through, and wavy examples, then explore link styling, sale prices, and dotted underlines.

📜 Decoration Line Types

Demonstrate different text-decoration values — matching the reference example.

Example 1 — Underline, overline, line-through, and wavy underline

In this example, we’ll demonstrate different text-decoration values.

index.html
<style>
  .underline { text-decoration: underline; }
  .overline { text-decoration: overline; }
  .line-through { text-decoration: line-through; }
  .custom { text-decoration: underline wavy red; }
</style>

<p class="underline">This text is underlined.</p>
<p class="custom">This text has a wavy red underline.</p>
Try It Yourself

How It Works

Each class applies a different decoration line. The custom class combines line type, style, and color in one shorthand rule.

Example 2 — Remove underline from links

Use text-decoration: none; when you want clean navigation links without the default underline.

nav-links.css
nav a {
  text-decoration: none;
  color: #2563eb;
}

nav a:hover {
  text-decoration: underline;
}
Try It Yourself

How It Works

none removes decoration lines. Many sites add underline back on hover so links still feel interactive.

📄 Practical Use Cases

Use decoration lines for pricing, emphasis, and styled link treatments.

Example 3 — Line-through for sale prices

Strike through the original price while showing the new discounted price beside it.

sale-price.css
.old-price {
  text-decoration: line-through;
  color: #94a3b8;
}

.new-price {
  color: #059669;
  font-weight: 700;
}
Try It Yourself

How It Works

line-through draws a horizontal line through the text, making it a common pattern for old prices.

Example 4 — Dotted blue underline

Combine underline with a dotted style and custom color for glossary or helper links.

dotted-link.css
.help-link {
  text-decoration: underline dotted #2563eb;
  color: #1e40af;
}
Try It Yourself

How It Works

Shorthand order typically includes the line type, style keyword, and color value.

text-decoration in the family

text-decoration is shorthand for line, style, color, and thickness. When you need finer control, use the longhand properties such as text-decoration-color and text-decoration-style.

longhand.css
.note-link {
  text-decoration-line: underline;
  text-decoration-style: wavy;
  text-decoration-color: #dc2626;
}

🧠 How text-decoration Works

1

You choose a decoration

Pick a line type such as underline, overline, line-through, or none.

Line
2

Optional style and color

Add style keywords like wavy or dotted, plus a color or thickness if needed.

Style
3

Browser draws the line

The decoration appears relative to the text glyphs, not as a separate border on the box.

Rendering
=

Styled text emphasis

Links, prices, and highlighted terms get clear visual treatment with decoration lines.

Browser Compatibility

The text-decoration property is widely supported across all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. The text-decoration-thickness and text-decoration-style sub-properties are also supported in most modern browsers, but it is always a good practice to test your website to ensure compatibility.

Baseline · Universal support

Core decoration lines everywhere

Basic values like underline and line-through work in all major browsers. Advanced style and thickness support is strong in current versions.

98% Modern browser support
Google Chrome 1+ · Desktop & Mobile
Full support
Mozilla Firefox 1+ · Desktop & Mobile
Full support
Apple Safari 1+ · macOS & iOS
Full support
Microsoft Edge 12+ · All versions
Full support
Opera 3.5+ · Modern versions
Full support

Testing tip

Check wavy and dotted underline styles in Safari and Firefox if your design relies on decorative link treatments.

text-decoration property 98% supported

Bottom line: text-decoration is safe to use for links, prices, and text emphasis in modern projects.

Conclusion

The text-decoration property is a versatile tool for adding emphasis or style to your text.

Whether you need underlines, overlines, or line-throughs, this property offers a range of options to enhance your typography. Experiment with different values and combinations to find the perfect style for your text elements.

💡 Best Practices

✅ Do

  • Use underline to show clickable links
  • Remove underlines with none when navigation design calls for it
  • Use line-through for old prices or deleted items
  • Try shorthand like underline wavy red for styled emphasis
  • Restore underline or another visual cue on hover for accessibility

❌ Don’t

  • Use blink in production pages
  • Rely on color alone to show links when underline is removed
  • Confuse text-decoration with border-bottom on links
  • Overuse wavy or decorative lines in long body text

Key Takeaways

Knowledge Unlocked

Five things to remember about text-decoration

Use these points when styling links and emphasized text.

5
Core concepts
02

underline

Most common.

Line
03

line-through

Strike text.

Line
04

Shorthand

Style + color.

Syntax
🔄 05

Longhand props

Fine control.

Companion

❓ Frequently Asked Questions

text-decoration adds decorative lines to text, such as underlines, overlines, or strike-through lines. It is a shorthand for line, style, color, and thickness.
The default value is none, which means no decoration line is applied.
Set text-decoration: none on the link or anchor element.
Yes. Modern shorthand supports values like text-decoration: underline wavy red;
No. Blink is deprecated, poorly supported, and can be distracting or inaccessible. Avoid it in real projects.

Practice in the Live Editor

Open the HTML editor and try text-decoration: underline wavy red; on a span or link.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful