HTML Headings
HTML headings are the titles or subtitles you want to show on a web page. They are made with the tags <h1> through <h6>. <h1> is the most important heading and <h6> is the least important.
Note: Browsers add some space (a margin) before and after each heading automatically.
Example
All six heading levels, from most to least important.
Output: complete HTML page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>All Headings</title>
</head>
<body>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
</body>
</html>
Headings Are Important
Headings matter for more than looks. Search engines use them to understand the structure and content of your pages, and readers often skim a page by its headings.
Use them in order to show structure: <h1> for the page title, <h2> for section titles, <h3> for sub-sections, and so on.
Tip: Use only one <h1> per page; it is the main topic or title. Note: Use headings only for headings, not to make text big or bold.
Example
Headings used to lay out the structure of a travel guide.
Output: complete HTML page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Heading Structure</title>
</head>
<body>
<h1>Travel Guide</h1>
<h2>Europe</h2>
<h3>France</h3>
<h3>Italy</h3>
<h2>Asia</h2>
<h3>India</h3>
<h3>Thailand</h3>
</body>
</html>
Bigger Headings
Each heading has a default size, but you can set any size with the style attribute and the CSS font-size property.
Example
An <h1> made 60 pixels tall.
Output: complete HTML page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bigger Heading</title>
</head>
<body>
<h1 style="font-size:60px;">Heading 1</h1>
</body>
</html>