CSS Reference ยท Typography
The text-decoration-style property
Reference for the CSS text-decoration-style property: solid, double, dotted, dashed and wavy lines for underlines and strike-throughs, with live examples.
The text-decoration-style property chooses how the decoration line is drawn: a plain solid line, a double line, dotted, dashed or wavy. The wavy style is familiar from spell checkers, so use it carefully, because readers may take it as an error mark.
CSS
.hint { text-decoration-line: underline; text-decoration-style: dotted; }
Try it
Syntax
CSS
text-decoration-style: solid | double | dotted | dashed | wavy;
- Initial value:
solid - Applies to: all elements; also
::first-letterand::first-line - Inherited: no
- Animatable: no
- Computed value: as specified
Values
| Value | Description |
|---|---|
solid |
A single continuous line. |
double |
Two parallel lines. |
dotted |
A line of dots. |
dashed |
A line of dashes. |
wavy |
A wavy (squiggly) line. |
Usage notes
- It needs a line. The style is visible only when
text-decoration-lineis notnone. - Thickness matters.
doubleneeds enough thickness to separate its two lines; with very thin lines it can look like a single line. Increasetext-decoration-thicknessif needed. - Wavy means error to many people. Reserve it for validation hints or playful headings.
- Shorthand resets. Using the
text-decorationshorthand later in the cascade resets the style tosolidunless you include it. - Line-through and overline use the same styles.
- Skipping ink. Browsers may interrupt the line around descenders; this is controlled by
text-decoration-skip-ink, and it happens for underlines and overlines.
Browser support
Supported in current versions of all major browsers.
Related
text-decorationโ the shorthandtext-decoration-lineโ which line to drawtext-decoration-thicknessโ line weight- Lesson: Styling Text