Skip to main content

Specify a Style for the Decoration Line

The text-decoration-style property sets the style of the decoration line. It can take one of these values:

  • solid — the default, a single line.
  • double — a double line.
  • dotted — a dotted line.
  • dashed — a dashed line.
  • wavy — a wavy line.

Example

Each element shows a different underline style.

Prompt
An HTML page that shows the text-decoration-style property. In an internal <style> block, underline several elements with different styles: solid, double, dotted, dashed, wavy, and a red wavy one. Use h1, h2, h3, and paragraph classes. Add an element for each.
Output: complete HTML page

Specify the Thickness for the Decoration Line

The text-decoration-thickness property sets the thickness of the decoration line.

Example

Each element shows a different underline thickness: auto, 5px, 25%, and a thick double line.

Prompt
An HTML page that shows the text-decoration-thickness property. In an internal <style> block, underline elements with different thicknesses: auto, 5px, 25%, and a paragraph combining a red double underline at 5px thickness. Use h1, h2, h3, and a paragraph. Add an element for each.
Output: complete HTML page

The Shorthand Property

The text-decoration property is a shorthand for: text-decoration-line (required), text-decoration-color (optional), text-decoration-style (optional), and text-decoration-thickness (optional).

Example

The shorthand sets the line, color, style, and thickness in one declaration.

Prompt
An HTML page that shows the text-decoration shorthand property. In an internal <style> block, use the shorthand on four elements: underline; underline red; underline red double; and underline red double 5px. Use h1, h2, h3, and a paragraph. Add an element for each.
Output: complete HTML page

A Small Tip on Links

All links are underlined by default. Sometimes you see links with no underline. Use text-decoration: none to remove the underline from links.

Example

The underline is removed from the links.

Prompt
An HTML page that removes the default underline from links. In an internal <style> block, set a { text-decoration: none; } so links are not underlined. Add a couple of links.
Output: complete HTML page