DEV Community

Beey
Beey

Posted on

HTML: what tag is h1?

Table of contents

What an h1 does

Explanation

An h1 is the largest header in the HTML headers

It is also formatted bold without any CSS

What to use an h1 on

It is recommended to use an h1 for one of these things:

  • App title
  • Title of a post(If it allows HTML)

What to do with h1

When to use h1

Use h1 when you need:

  • An app title for your app
  • A title for a post(If it allows HTML)

When to not use h1

Do not use h1 when you need or follow one of these prequiristies:

  • there is already 1 h1 tag
  • you are using it for a thing that isnt a title

h1 tag code example

Here is a code example of using h1:


<!DOCTYPE html>
<html lang="en">
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>My webpage</title>
  </head>
  <body>
    <div id="App">
      <header>
        <h1>My app</h1>
      </header>
    </div>
  </body>
</html>

Enter fullscreen mode Exit fullscreen mode

Sources

developer.mozilla.org
w3.org

Top comments (0)