w3resource

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

Go to Exercise page

Solution:

HTML Code:

<!DOCTYPE html>
  <html>
  <head>
  <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;
  }
</style>
  </head>
  <body>
  <p><strong>w3resource Tutorial</strong></p>

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

  </body>
  </html>

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
YesYesYesYesYes

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.