Chapter 29: Text Decoration

Using the text-decoration property you can underline text.You can also over-line it, strike a line through it. You can also set it so that elements have no underline at all. Unfortunately you can't mix these properties, though quite frankly I can't see why you'd need to.

h2
{
 text-decoration: underline;
}

The above will underline all of the h2's in your document. This is a neat trick if you want your web-page to look a bit like a classic essay written in Microsoft Word.

Other text-decoration properties:

  • overline - puts a line on top of the text
  • linethrough - pits a line through the text, so it appears crossed out
  • none - regular text

Wellety wellety, have a look at the text-decoration property in action, then get into action yourself and take the end of chapter quiz.