Home Snippets Projects Donate

Get Snippets For:

   Java    HTML/CSS JavaScript

Headings

Code Description:

Headings are used to describe how your content is laid out on the web page. There are 6 different headings with different importance levels where <h1> is the most important and <h6> is the least. While each of these headings have a different default size, the heading elements should NOT be used to make text larger. CSS should be used to change the font size instead.

Heading Syntax:

<h1>Heading Level 1</h1>
<h2>Heading Level 2</h2>
<h3>Heading Level 3</h3>
<h4>Heading Level 4</h4>
<h5>Heading Level 5</h5>
<h6>Heading Level 6</h6>

Heading Level 1

Heading Level 2

Heading Level 3

Heading Level 4

Heading Level 5
Heading Level 6

Runnable Heading Example Code:

<!DOCTYPE html>
<html>
    <head>
        <title>Headings Example</title>
    </head>
 
    <body>
       <h1>Heading Level 1</h1>
       <h2>Heading Level 2</h2>
       <h3>Heading Level 3</h3>
       <h4>Heading Level 4</h4>
       <h5>Heading Level 5</h5>
       <h6>Heading Level 6</h6>
    </body>
</html>

How to Run This Code:

Simply paste this code into a plain text file with the ".html" extension and save it. You will then be able to open it in the web browser of your choice.

Related Links: