HTML Heading Tags
In HTML document heading tag range from 1 to 6, means there are 6 heading tags that can be used to define headings and sub headings. The proper usage of these heading tags provide much important information about page. These all headings are by default of different font size.
We can also define our required font size or format to each of these tags using CSS rules.
Importance of Heading
Heading tags are much more important in SEO (Search Engine Optimization). The proper hierarchy of heading tags are very important to rank high in search engines. It is recommended to use only one H1 tag in entire webpage, this will be the topic of web document. H1 tag may be more similar to the title of the page. We can use any number of H2 tags after our H1 tag. Subsequently all other heading tags can be used to define subheadings.
Heading tag syntax
All six heading tags are paired tags, means there is opening and closing tag. We have to write text inside these tags.
Heading Tag in HTML with Example
All six tags can be used in following way.
<h1>This is H1 tag</h1> <h2>This is H2 tag</h2> <h3>This is H3 tag</h3> <h4>This is H4 tag</h4> <h5>This is H5 tag</h5> <h6>This is H6 tag</h6>
HTML Heading rules
There are some strongly recommend rules that we have to use while using these tags.
- H2 always come after H1 tag.
- Never skip any of the heading tags.
- Follow the order of heading tags.
- Use H1 only one time.
- H1 should more prominent.
- H1 tag must be in start of the document.
Customize Heading tags
We can use custom formatting for each of the heading tags. For this purpose we will write CSS (Cascading Style Sheet) rules. By using CSS there may be fully custom format including their color, font size, font family, background color and all other text, font properties.