CSS Properties: How to set the text decoration for heading elements

Go to Exercise page


HTML Code:

<!DOCTYPE html>
  <title>How to set the text decoration for heading elements</title>
  <style type="text/css">
h1 {
  text-decoration: overline;
h2 {
  text-decoration: underline;
h3 {
  text-decoration: line-through;
  <p><strong>w3resource Tutorial</strong></p>

<h1>Heading 1 - overline</h1>
<h2>Heading 2 - underline</h2>
<h3>Heading 3 - line-through</h3>


Live Demo :

See the Pen text-decoration-answer by w3resource (@w3resource) on CodePen.

See the solution in the browser

Supported browser

Firefox logo Chrome logo Opera logo Safari logo Internet Explorer logo

Go to Exercise page

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.

Follow us on Facebook and Twitter for latest update.