Define HTML Headings | h1, h2, h3, h4, h5, and h6

How to define heading in html?

HTML defines six levels of headings. A heading element implies all the font changes, paragraph breaks before and after, and any white space necessary to render the heading. The heading elements are H1, H2, H3, H4, H5, and H6 with H1 being the highest (or most important) level and H6 the least.

Headings in a HTML document help the developer to outlay its structure. There are six levels of HTML tags that begin with <h1> to <h6>. H1 Headings are of greater importance than level two headings and the rest that come after it. Below is an example of an element that is used to display a heading on a webpage.

<h1> This is a heading 1</h1>


Each time a heading is created in a document, the web browser leaves a space before and after it to improve its readability and visual appeal. To change these default settings, a user should use the margin property in Cascading Style Sheets, a tool used to manipulate the appearance of objects on a HTML document. It is important to recall that search engines follow heading tags to read the structure of a document and use it as part of the ranking criteria in their algorithms.

With this in mind, avoid using the heading tags in HTML to bold or highlight text because doing so would mislead search engines that use the weight of keywords in a headings of a web page while ranking it. ?Normally, web pages have one <h1> tag which is followed by <h2>, <h3>, <h4>, <h5>, and <h6> tags.

<!DOCTYPE html>

<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>

<p><b>Tip:</b> Use h1 to h6 elements only for headings. Do not use them just to make text bold or big. Use other tags for that.</p>



Join Telegram Join Whatsapp