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.
Fundamentals
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.
Foundation
📝 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
Defaults
🎯 Default Value
The default value of the text-decoration-line property is none, meaning no text decoration is applied.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Default value
none
Common values
underline, overline, line-through
Remove link underline
text-decoration-line: none;
Pair with
text-decoration-color, text-decoration-style
Inherited
No
Animatable
No
Reference
💎 Property Values
Value
Example
Description
none
text-decoration-line: none;
No text decoration.
underline
text-decoration-line: underline;
Draws a line beneath the text.
overline
text-decoration-line: overline;
Draws a line above the text.
line-through
text-decoration-line: line-through;
Draws a line through the text.
blink
text-decoration-line: blink;
Causes the text to blink. Not widely supported and generally not recommended.
noneunderlineoverlineline-through
Context
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.
Preview
👀 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.
Hands-On
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><pclass="underline">This text has an underline.</p>
Navigation links appear without underlines until hover adds one back.
How It Works
none removes decoration lines. It is commonly used on menus and card links.
Companion
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.
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.
Compatibility
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 Chrome57+ · Desktop & Mobile
Full support
Mozilla Firefox36+ · Desktop & Mobile
Full support
Apple Safari8+ · macOS & iOS
Full support
Microsoft Edge79+ · Chromium
Full support
Opera44+ · Modern versions
Full support
Testing tip
Verify underline removal on links and line-through on prices in Safari and mobile browsers.
text-decoration-line property96% supported
Bottom line:text-decoration-line is safe to use for links, headings, and pricing UI in modern projects.
Wrap Up
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.