Text-decoration property

Last updated: 2026-09-13

text-decoration Text-decoration property

The text-decoration CSS property adds decorative lines to text, most commonly underlines, overlines, and line-through. It is the shorthand for four sub-properties: text-decoration-line, text-decoration-style, text-decoration-color, and text-decoration-thickness. By default, links (a elements) are underlined; reset styles usually remove that underline.

Category
Initial Valuenone
InheritedNo
Applies Toall
Animation Typeshadow
CSS VersionCSS1
StatusStandard

📝 Syntax

text-decoration: <text-decoration-line> || <text-decoration-style> || <text-decoration-color> || <text-decoration-thickness>;

⚙️ Values

ValueTypeDescription
<text-decoration-line> || <text-decoration-style> || <text-decoration-color> || <text-decoration-thickness>ValueText decoration shorthand (underline, line-through, etc.)

▶ Example

Edit the code below and see the live result in the playground:

🌐 Browser Support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
text-decoration v1 v12 v1 v1 v1
Supported in all major browsers
Tip: Use text-decoration: none; to remove the default underline from links, but keep some other visual cue (such as a color change) to preserve accessibility.
Important: text-decoration no longer inherits by default in CSS3, yet the decoration of an ancestor still renders across a child's text. Use its sub-properties if you need fine-grained control.

❓ FAQ

QWhat is the difference between text-decoration and border-bottom underlines?
AThe line drawn by text-decoration hugs the text, with position and thickness controlled by the browser; border-bottom is the element's bottom border, sitting at the bottom of the whole line, where you can precisely control style, color, and distance — though it stretches with the element's full width.
QHow do I change just the underline's color or line style in CSS?
AUse the three sub-properties: text-decoration-color for color, text-decoration-style for the line type (solid, dashed, dotted, wavy), and text-decoration-thickness for width. Each can be set independently while the others stay at their defaults.
QHow can I remove the default underline from links using only CSS?
AWrite text-decoration: none on the link. After removing it, keep another visual distinction such as a color change or hover effect, otherwise users may not recognize the link and accessibility suffers.

📚 Related Tutorials

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏