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.
Fundamentals
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.
Foundation
📝 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:underlinewavyred;}
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
Defaults
🎯 Default Value
The default value of the text-decoration property is none, which means no decoration is applied to the text.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Default value
none
Common line values
underline, overline, line-through
Shorthand example
underline wavy red
Remove link underline
text-decoration: none;
Inherited
No
Animatable
Color only (in supporting browsers)
Reference
💎 Property Values
Value
Example
Description
none
text-decoration: none;
Removes any text decoration.
underline
text-decoration: underline;
Adds an underline beneath the text.
overline
text-decoration: overline;
Adds a line above the text.
line-through
text-decoration: line-through;
Adds a line through the text.
blink
text-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:
Component
What it controls
Example values
text-decoration-color
Color of the decoration line
red, #2563eb
text-decoration-style
Style of the decoration line
solid, double, dotted, dashed, wavy
text-decoration-thickness
Thickness of the decoration line
auto, 2px, 0.1em
noneunderlineoverlineline-throughwavy red
Context
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.
Preview
👀 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.
Hands-On
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:underlinewavyred;}</style><pclass="underline">This text is underlined.</p><pclass="custom">This text has a wavy red underline.</p>
Shorthand order typically includes the line type, style keyword, and color value.
Companion
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.
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.
Compatibility
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 Chrome1+ · Desktop & Mobile
Full support
Mozilla Firefox1+ · Desktop & Mobile
Full support
Apple Safari1+ · macOS & iOS
Full support
Microsoft Edge12+ · All versions
Full support
Opera3.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 property98% supported
Bottom line:text-decoration is safe to use for links, prices, and text emphasis in modern projects.
Wrap Up
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.
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
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about text-decoration
Use these points when styling links and emphasized text.
5
Core concepts
★01
none Default
No line applied.
Default
⚙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.