bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/CSS/CSS Foundations
CSS•CSS Foundations

CSS Text Decoration Styles

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind CSS Text Decoration Styles?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___-decoration-line: underline;
3Order

Put the learning moves in the order that makes the concept easiest to apply.

The Shorthand Property
Specify the Thickness for the Decoration Line
Specify a Style for the Decoration Line

Specify a Style for the Decoration Line

The CSS text-decoration-style property sets the style of the decoration line.

This property can have one of the following values:

  • solid - Default value. Single line
  • double - Double line
  • dotted - Dotted line
  • dashed - Dashed line
  • wavy - Wavy line

Example

Formatted code
h1 {
  text-decoration-line: underline;
  text-decoration-style: solid;
}
h2 {
  text-decoration-line: underline;
  text-decoration-style: double;
}
h3 {
  text-decoration-line: underline;
  text-decoration-style: dotted;
}
p.ex1 {
  text-decoration-line: underline;
  text-decoration-style: dashed;
}
p.ex2 {
  text-decoration-line: underline;
  text-decoration-style: wavy;
}
p.ex3 {
  text-decoration-line: underline;
  text-decoration-color: red;
  text-decoration-style: wavy;
}

Live preview

Specify the Thickness for the Decoration Line

The CSS text-decoration-thickness property is used to set the thickness of the decoration line.

Example

Formatted code
h1 {
  text-decoration-line: underline;
  text-decoration-thickness: auto;
}
h2 {
  text-decoration-line: underline;
  text-decoration-thickness: 5px;
}
h3 {
  text-decoration-line: underline;
  text-decoration-thickness: 25%;
}
p {
  text-decoration-line: underline;
  text-decoration-color: red;
  text-decoration-style: double;
  text-decoration-thickness: 5px;
}

Live preview

The Shorthand Property

The CSS text-decoration property is a shorthand property for:

  • text-decoration-line (required)
  • text-decoration-color (optional)
  • text-decoration-style (optional)
  • text-decoration-thickness (optional)

Example

Formatted code
h1 {
  text-decoration: underline;
}
h2 {
  text-decoration: underline red;
}
h3 {
  text-decoration: underline
  red double;
}
p {
  text-decoration: underline red double 5px;
}

Live preview

A Small Tip on Links

All links in HTML are underlined by default. Sometimes you see that links are styled with no underline. The text-decoration: none; is used to remove the underline from links, like this:

Example

Formatted code
a {
  text-decoration: none;
}

Live preview

Previous

CSS Text Decoration

Next

CSS Text Transformation