CSS text-decoration-line Property

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

What You’ll Learn

The text-decoration-line property chooses which decoration lines appear on text — underline, overline, line-through, or none.

01

underline

Line below.

02

overline

Line above.

03

line-through

Strike text.

04

none

Remove lines.

05

Longhand

Fine control.

06

Combine

Multiple lines.

Introduction

The text-decoration-line property in CSS is used to specify what kind of text decoration should be applied to the text.

This property allows you to add underlines, overlines, line-throughs, or a combination of these to your text, giving you greater control over text styling.

Definition and Usage

Use text-decoration-line when you want to control only the line type, then pair it with text-decoration-color and text-decoration-style for full decoration styling.

It is the longhand alternative to setting line types inside the text-decoration shorthand.

💡
Beginner Tip

Links often use text-decoration-line: underline;. Navigation menus frequently use text-decoration-line: none; to remove the default underline.

📝 Syntax

The syntax for the text-decoration-line property is simple. It can take one or more values to specify the desired text decoration:

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

Basic Example

underline-line.css
p.underline {
  text-decoration-line: underline;
}

Syntax Rules

  • Use none to remove decoration lines from text or links.
  • Line keywords include underline, overline, and line-through.
  • You can combine values such as underline overline in supporting browsers.
  • Pair with color and style longhands for complete decoration control.

Related Properties

  • text-decoration — shorthand for line, style, color, and thickness
  • text-decoration-color — sets decoration line color
  • text-decoration-style — sets solid, dotted, dashed, or wavy lines
  • text-decoration-thickness — sets line thickness

🎯 Default Value

The default value of the text-decoration-line property is none, meaning no text decoration is applied.

⚡ Quick Reference

QuestionAnswer
Default valuenone
Common valuesunderline, overline, line-through
Remove link underlinetext-decoration-line: none;
Pair withtext-decoration-color, text-decoration-style
InheritedNo
AnimatableNo

💎 Property Values

ValueExampleDescription
nonetext-decoration-line: none;No text decoration.
underlinetext-decoration-line: underline;Draws a line beneath the text.
overlinetext-decoration-line: overline;Draws a line above the text.
line-throughtext-decoration-line: line-through;Draws a line through the text.
blinktext-decoration-line: blink;Causes the text to blink. Not widely supported and generally not recommended.
none underline overline line-through

When to Use text-decoration-line

text-decoration-line is the right choice when you need to control line type separately:

  • Links — Add or remove underlines on anchors and buttons.
  • Headings — Use overline for decorative title treatments.
  • Pricing UI — Apply line-through to old prices.
  • Design systems — Split line, color, and style into separate longhand rules.

👀 Live Preview

Common text-decoration-line effects on sample text:

This text has an underline.
This text has an overline.
This text has a line through it.
This text has underline and overline.

Examples Gallery

Start with the reference underline example, then try overline headings, sale strike-through, and removing link underlines with none.

📜 Decoration Line Types

Apply underline, overline, and line-through effects — matching the reference example.

Example 1 — Underline text

In this example, we’ll demonstrate how to use the text-decoration-line property to underline text.

index.html
<style>
  p.underline {
    text-decoration-line: underline;
  }
</style>

<p class="underline">This text has an underline.</p>
Try It Yourself

How It Works

The browser draws a line beneath the text glyphs when underline is set.

Example 2 — Overline on a heading

Use text-decoration-line: overline; for decorative heading treatments.

overline-heading.css
h2.section-title {
  text-decoration-line: overline;
  text-decoration-color: #2563eb;
}
Try It Yourself

How It Works

Overline draws a decoration line above the text. Pair it with text-decoration-color for branded styling.

📄 Practical Use Cases

Use line-through for pricing and none to clean up navigation links.

Example 3 — Line-through for sale prices

Strike through an old price while showing the new price beside it.

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

How It Works

line-through is the standard way to show discounted or removed prices.

Example 4 — Remove underline from navigation links

Set text-decoration-line: none; on links when your design uses color instead of underlines.

nav-none.css
nav a {
  text-decoration-line: none;
  color: #1e40af;
}

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

How It Works

none removes decoration lines. It is commonly used on menus and card links.

text-decoration-line in the family

text-decoration-line chooses which lines appear. Combine it with text-decoration-color and text-decoration-style, or use the text-decoration shorthand when you want all parts in one declaration.

full-decoration.css
.help-link {
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-color: #2563eb;
}

🧠 How text-decoration-line Works

1

You choose a line type

Set underline, overline, line-through, or none on the text element.

Line type
2

Optional style and color

Add text-decoration-color and text-decoration-style for full control.

Longhand
3

Browser draws the line

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

Rendering
=

Clear text emphasis

Links, headings, and prices get the right visual line treatment.

Browser Compatibility

The text-decoration-line property is supported in most modern browsers, including current versions of Chrome, Firefox, Safari, Edge, and Opera. It is always a good practice to test your website across different browsers to ensure compatibility.

Modern browsers · Wide support

Reliable line-type control

Chrome, Firefox, Safari, Edge, and Opera all support text-decoration-line in current versions.

96% Modern browser support
Google Chrome 57+ · Desktop & Mobile
Full support
Mozilla Firefox 36+ · Desktop & Mobile
Full support
Apple Safari 8+ · macOS & iOS
Full support
Microsoft Edge 79+ · Chromium
Full support
Opera 44+ · Modern versions
Full support

Testing tip

Verify underline removal on links and line-through on prices in Safari and mobile browsers.

text-decoration-line property 96% supported

Bottom line: text-decoration-line is safe to use for links, headings, and pricing UI in modern projects.

Conclusion

The text-decoration-line property is a useful tool for adding various text decorations to your content.

Whether you need to underline, overline, or strike through your text, this property gives you the flexibility to enhance your text styling in a visually appealing way. Experiment with different values to see how this property can improve the readability and design of your web projects.

💡 Best Practices

✅ Do

  • Use underline for links and emphasized inline text
  • Use line-through for old or removed prices
  • Remove underlines with none when your design uses other link cues
  • Pair with color and style longhands for polished decoration effects
  • Restore underline on hover for accessible navigation links

❌ Don’t

  • Use blink in production pages
  • Remove all link underlines without another visible cue
  • Confuse decoration lines with border-bottom
  • Overuse overline on long paragraphs where underline reads better

Key Takeaways

Knowledge Unlocked

Five things to remember about text-decoration-line

Use these points when choosing decoration line types.

5
Core concepts
02

underline

Most common.

Line
03

line-through

Sale prices.

Line
04

Longhand

Line only.

Role
🔄 05

text-decoration

Shorthand pair.

Companion

❓ Frequently Asked Questions

text-decoration-line sets which decoration lines appear on text, such as underline, overline, or line-through.
The default value is none, which means no decoration line is applied.
text-decoration is shorthand for line, style, color, and thickness. text-decoration-line controls only which lines are drawn.
Yes. You can use values like underline overline to draw more than one line on the same text in supporting browsers.
No. Blink is deprecated, poorly supported, and can distract users or cause accessibility issues.

Practice in the Live Editor

Open the HTML editor and try text-decoration-line: underline; on a paragraph 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