CSS: Text-decoration

The text-decoration property specifies the decoration added to text. It can be applied with an internal stylesheet in the <style> element (H1 example), or with the id or class attribute (H2 example), or with inline styling (H3 examples):

HTML file: Displayed by browser:
<head>
  <style>
h1 {
    text-decoration: overline;
}
h2#lt {
    text-decoration: line-through;
}
  </style>
</head>
<body>
  <h1>This is heading 1 with overline</h1>
  <h2 id="lt">This is heading 2 with a line through</h2>
  <h3 style="text-decoration: underline;">This is heading 3 with underline</h3>
  <p style="text-decoration: none;">This is a paragraph with nothing (which is also the default setting). The NONE value is most often used to remove the underline from link text.</p>
</body>

This is heading 1 with overline

This is heading 2 with a line through

This is heading 3 with underline

This is a paragraph with nothing (which is also the default setting). The NONE value is most often used to remove the underline from link text.


Back button Table of Contents Next button