text-decoration
The text-decoration shorthand CSS property sets the appearance of decorative lines on text. It is a shorthand for text-decoration-line, text-decoration-color, text-decoration-style, and the newer text-decoration-thickness property.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 1 | 12 | 1 | 1 | 18 | 1 | |
| The text-decoration-color CSS property sets the color of decorations added to text by . | 57 | 79 | 36 | 12.1 | 57 | 12.2 |
| The text-decoration-line CSS property sets the kind of decoration that is used on text in an element, such as an underline or overline. | 57 | 79 | 36 | 12.1 | 57 | 12.2 |
line-through | 57 | 79 | 6 | 8 | 57 | 8 |
none | 57 | 79 | 6 | 8 | 57 | 8 |
overline | 57 | 79 | 6 | 8 | 57 | 8 |
underline | 57 | 79 | 6 | 8 | 57 | 8 |
| The text-decoration-style CSS property sets the style of the lines specified by . The style applies to all lines that are set with text-decoration-line. | 57 | 79 | 36 | 12.1 | 57 | 12.2 |
wavy | 57 | 79 | 6 | 8 | 57 | 8 |
| The text-decoration-thickness CSS property sets the stroke thickness of the decoration line that is used on text in an element, such as a line-through, underline, or overline. | 89 | 89 | 70 | 12.1 | 89 | 12.2 |
auto | 87 | 87 | 70 | 12.1 | 87 | 12.2 |
from-font | 87 | 87 | 70 | 12.1 | 87 | 12.2 |
percentage percentage values | 87 | 87 | 74 | 17.4 | 87 | 17.4 |
includes color-and-style `text-decoration-color` and `text-decoration-style` included in shorthand | 57 | 79 | 6 | 26.2 | 57 | 26.2 |
includes thickness `text-decoration-thickness` included in shorthand | 87 | 87 | 70 | 26.2 | 87 | 26.2 |
- This feature was removed in a later browser version (39)
- Available with a vendor prefix: -moz- (6)
- Available with a vendor prefix: -webkit- (8)
- Available with a vendor prefix: -webkit- (8)
- This feature was removed in a later browser version (39)
- Available with a vendor prefix: -moz- (6)
- Available with a vendor prefix: -webkit- (8)
- Available with a vendor prefix: -webkit- (8)
- This feature was removed in a later browser version (39)
- Available with a vendor prefix: -moz- (6)
- Available with a vendor prefix: -webkit- (8)
- Available with a vendor prefix: -webkit- (8)
- This browser only partially implements this feature
- This feature was removed in a later browser version (89)
- The `text-decoration-thickness` property has no effect unless `text-underline-offset`, `text-decoration-color`, or `text-decoration-style` are set to a non-initial value. See bug 40734940.
- This browser only partially implements this feature
- This feature was removed in a later browser version (89)
- The `text-decoration-thickness` property has no effect unless `text-underline-offset`, `text-decoration-color`, or `text-decoration-style` are set to a non-initial value. See bug 40734940.
- This browser only partially implements this feature
- This feature was removed in a later browser version (89)
- The `text-decoration-thickness` property has no effect unless `text-underline-offset`, `text-decoration-color`, or `text-decoration-style` are set to a non-initial value. See bug 40734940.
- Available with a vendor prefix: -webkit- (8)
- Available with a vendor prefix: -webkit- (8)
Syntax
.fancy-underline {
text-decoration-line: underline;
text-decoration-color: #e63946;
text-decoration-style: wavy;
text-decoration-thickness: 2px;
}
/* Shorthand */
.shorthand {
text-decoration: underline wavy #e63946 2px;
} Live demo
Use cases
-
Using text-decoration
The text-decoration shorthand CSS property sets the appearance of decorative lines on text.
Cautions
- May not be supported in older browsers.
Accessibility
- Make sure visual changes are conveyed appropriately to assistive technology.