CSS Reference ยท Typography
The text-decoration-line property
Reference for the CSS text-decoration-line property: underline, overline and line-through, combining several lines, and how it differs from the shorthand.
The text-decoration-line property chooses which lines are drawn on text: an underline below, an overline above or a line-through across the middle. Without a line, the other decoration properties (style, color, thickness) have no visible effect. You can list more than one line type at once.
.deleted { text-decoration-line: line-through; }
Try it
Syntax
text-decoration-line: none | [ underline || overline || line-through || blink ] | spelling-error | grammar-error;
- Initial value:
none - Applies to: all elements; also
::first-letterand::first-line - Inherited: no (but the line is drawn across in-flow inline descendants)
- Animatable: no
- Computed value: as specified
Values
| Value | Description |
|---|---|
none |
No line. |
underline |
A line below the text. |
overline |
A line above the text. |
line-through |
A line through the middle of the text (strikethrough). |
blink |
Blinking text. Deprecated; browsers are not required to support it, and you should not use it. |
spelling-error, grammar-error |
Browser-style error marks. Defined for use by browsers and special cases; support in author CSS is very limited, so check a compatibility table. |
Usage notes
- Combine by listing.
underline line-throughdraws both lines. Order does not matter. - Does not draw on its own descendants. A parent's line passes through inline children and cannot be turned off by them.
noneon<a>.text-decoration-line: noneremoves the default link underline, but keep another cue for links.- Semantic strike-through. Use
<del>or<s>in HTML when the meaning matters, and use the property for purely visual strikes. - Flashing is an accessibility risk. Do not use
blink; it is also ignored by most browsers. - Shorthand resets. Writing
text-decoration: ...after this property resets it. Order your declarations accordingly.
Browser support
none, underline, overline and line-through are supported in every modern browser. spelling-error and grammar-error are not widely usable; blink is deprecated.
Related
text-decorationโ the shorthandtext-decoration-styleandtext-decoration-colorโ how the line lookstext-decoration-thicknessโ line weight- Lesson: Styling Text