Welcome to the another most interactive article on HTML.
In this article we will learn html headings and how to implement headings in html.
HTML Headings
A HTML heading or HTML h tag is used to define the title or subtitle of a page. There are six levels of headings defined by HTML <h1> to <h6> where <h1> is defined as most important heading and <h6> is defined as least important heading.
Adding headings to HTML web pages is good practice because search engines use headings to index the structure and content of your HTML page.
Now let's illustrate HTML headings with the help of following example;
<!DOCTYPE html><html>
<head>
<title>Html Headings Example</title>
</head>
<body>
<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>
</body>
</html>
Output
In the above example, we have used <h1> to <h6> tags to differentiate headings and font sizes. You can see here that the font size of <h1> is larger than that of <h6>.
Changing the size of HTML heading
As we know each HTML heading has a default size but the default size of HTML headings can be changed by using style attribute and font size property.
Now let's illustrate changing the size of html heading with the help of following example;
<!DOCTYPE html><html>
<head>
<title>Html h1 with style attribute Example</title>
</head>
<body>
<!--this is simple h1 tag-->
<h1>This is heading 1</h1>
<!--this is h1 tag with sytle attribute-->
<h1 style="font-size: 50px">H1 with new size</h1>
</body>
</html>
Output
Conclusion
Above we have discussed about html headings and how to implement headings in html. A HTML heading or HTML h tag is used to define the title or subtitle of a page. There are six levels of headings defined by HTML <h1> to <h6> where <h1> is defined as most important heading and <h6> is defined as least important heading. I hope this information is helpful to you all.