The structure and hierarchy of the content on a web page are defined by headings.
<h1>
through <h6>
are the six levels of heading tags available in HTML; the lower the heading level number, the more significant the heading is. the <h6>
tag defines the least important heading in the document, while the tag defines the most important heading.
Headings are displayed in a bolder, larger font than regular text by default in browsers. Moreover, headings with <h1>
are shown in the largest font, while headings with <h6>
are shown in the smallest font.
<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>
— The output from the previous scenario will look like this:
Note: The built-in style sheets in web browsers automatically add a margin—a space—before and after each heading tag when you set one on a page. To change the browser's default style sheet, use the CSS margin
property.
Tip: The CSS font properties make it simple to alter the appearance of HTML heading tags, including their font size, boldness, typeface, etc.
<h1>
headings as the primary headings, then the <h2>
headings, the <h3>
headings, and so on.Tip: Use the <h1>
tag to mark the most important heading which is usually at the top of the page. An HTML document generally should have exactly one <h1>
heading, followed by the lower-level headings such as <h2>
, <h3>
, <h4>
, and so on.