CSS text-decoration-line Property

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The text-decoration-line property sets which decoration lines appear on text—underline, overline, line-through, or none. It is the line longhand of the text-decoration shorthand.

Prefer this longhand when you only want to toggle the line and keep text-decoration-style, text-decoration-color, and text-decoration-thickness unchanged.

Standard-track.

Baseline widely available for the common line keywords. Not deprecated as a property.

Deprecated blink

Do not use text-decoration-line: blink. It is deprecated, often ignored, and inaccessible.

Limited support.

spelling-error and grammar-error use the browser’s native error styling and are newer (Chrome/Edge 121+, Firefox 137+, Safari 26.2+).

CSS Syntax

syntax.css
text-decoration-line: none | underline || overline || line-through | initial | inherit;

Combine line keywords with spaces (for example underline overline). blink, spelling-error, and grammar-error exist but are special cases—see the callouts above.

Property Values

ValueDescriptionTry it
noneNo decoration line (initial)Try it
underlineLine under the textTry it
overlineLine above the textTry it
line-throughStrike-through across the textTry it
underline overlineTwo lines on the same textTry it
inheritTakes the parent’s text-decoration-lineTry it

How to Use text-decoration-line

Pick the line keyword(s) you need. Add style or color only with the other longhands.

  1. Choose underline, overline, line-through, or none.
  2. Combine keywords with spaces when you want more than one line.
  3. Use this longhand (not the shorthand) when style or color must stay put.
  4. Tune look with text-decoration-style and text-decoration-color.
GoalTypical value
Link underlineunderline
Remove underlinenone
Deleted / struck textline-through
Both above and belowunderline overline

Live Preview

Same sentence. Change only text-decoration-line.

Line keywords can combine. Style and color stay at their defaults here.

Text

Sample decoration line

text-decoration-line: underline

CSS Examples

Each snippet focuses on text-decoration-line. Use Try It Yourself for a live editor.

Example 1 — Underline Text

Draw a solid underline with the line longhand.

CSS
<style>
  p {
    text-decoration-line: underline;
  }
</style>

<p>Sample decoration line</p>
Try It Yourself

How It Works

  1. Choose the line. underline places a decoration under the glyphs.
  2. Keep other longhands. Style stays solid and color stays currentColor by default.
  3. Longhand advantage. Unlike the shorthand, this does not reset thickness or color.
  4. Where it paints. The line follows this element’s text and descendants.

Example 2 — Remove a Link Underline

Turn off the default underline without touching other decoration settings.

CSS
<style>
  a {
    text-decoration-line: none;
  }
</style>

<a href="#">Plain link</a>
Try It Yourself

How It Works

  1. Target the link. User-agent styles often underline a elements.
  2. Clear the line. none is the initial value and removes the decoration.
  3. Keep meaning clear. Color or weight can still show that the text is a link.
  4. Hover tip. Many designs restore underline on :hover / :focus-visible.

Example 3 — Combine Underline and Overline

Space-separate keywords to draw more than one line.

CSS
<style>
  p {
    text-decoration-line: underline overline;
  }
</style>

<p>Sample decoration line</p>
Try It Yourself

How It Works

  1. List the lines. underline and overline are both allowed together.
  2. Order is flexible. overline underline draws the same pair.
  3. Shared style/color. One style and one color apply to all lines on the element.
  4. Add strike. You can also include line-through in the same list.

Edge Cases & Pitfalls

If a decoration looks wrong, one of these is usually why.

child

Children cannot erase a parent line

A parent underline still paints through a child. text-decoration-line: none on the child does not remove it; the child can only add another line.

shorthand

Prefer the longhand to preserve color

Setting text-decoration: underline on hover can wipe a custom color or thickness. Toggle with text-decoration-line instead.

blink

Avoid blink

The blink value is deprecated and should not be used in production CSS.

errors

spelling-error / grammar-error are special

They use native browser error styling and ignore many other decoration longhands. Support is still catching up—do not rely on them for critical UI yet.

inherit

Not inherited by default

The property’s inherited flag is no. Use the inherit keyword when a child must take the parent’s line value.

Browser Support

text-decoration-line is a browser CSS property for decoration lines. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available since Jan 2020

text-decoration-line

Common keywords: Chrome 57+, Firefox 36+, Safari 12.1+, Edge 79+. spelling-error / grammar-error: Chrome/Edge 121+, Firefox 137+, Safari 26.2+. Not supported as a longhand in Internet Explorer.

97% Common keywords support
Google Chrome 57+
Full support
Mozilla Firefox 36+
Full support
Apple Safari 12.1+
Full support
Microsoft Edge 79+
Full support
Opera 44+
Full support
Samsung Internet 7+
Full support
Internet Explorer No longhand
Not supported
text-decoration-line Widely supported

Bottom line: Safe for none, underline, overline, and line-through in modern browsers. Treat spelling/grammar values as progressive enhancement.

Key Takeaways

  • Role: chooses which decoration lines are drawn on text.
  • Common values: none, underline, overline, line-through.
  • Initial value: none. Not inherited.
  • Pitfall: a child none does not cancel a parent decoration.

One line: use text-decoration-line to draw or clear lines without resetting style, color, or thickness.

Frequently Asked Questions

It chooses which decoration lines appear on text: none, underline, overline, line-through, or a combination of those keywords.
none. No decoration line is drawn until you set one.
text-decoration is the shorthand for line, style, color, and thickness. text-decoration-line controls only which lines are drawn, so it does not reset style or color.
Yes. Space-separate keywords, for example text-decoration-line: underline overline.
No. blink is deprecated, often ignored, and inaccessible. Prefer CSS animations if you need motion.
Baseline widely available for none, underline, overline, and line-through (Chrome 57+, Firefox 36+, Safari 12.1+, Edge 79+). spelling-error and grammar-error are newer. It is a browser CSS property, not a Node.js feature.

Next: text-decoration-style

Learn solid, wavy, dashed, and dotted decoration styles.

text-decoration-style tutorial →

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.

8 people found this page helpful