CodesJava

Easy learning with example program codes

Heading tag in HTML

HTML Heading

An HTML heading is a tag which is used to specify a title or a subtitle to be displayed on the webpage. They also help in indexing the structure of a web page. The text within the heading tags is displayed in the bold format when executed. The HTML headings can be defined with the <h1> to <h6> tags, where the size of the text varies as per the number of heading. The highest level is h1. It can be used to represent the main heading. While h6 being the least level is used to define the least important heading. Heading elements are expected to be used for specifying the headings only, and not just to format any text to bold or big. Including Chrome, Internet Explorer, Opera, Safari and Firefox, all the popular browsers supports the HTML heading tags from h1 to h6.

Syntax:

<h1>Heading 1</h1>  
<h2>Heading 2</h2>  
<h3>Heading 3</h3>  
<h4>Heading 4</h4>  
<h5>Heading 5</h5>  
<h6>Heading 6</h6>

Example:

<!DOCTYPE html>
<html>
<head>
<title>Example</title>
</head>
<body>
<h1>Topic 1</h1>
<h2>Topic 2</h2>
<h3>Topic 3</h3>
<h4>Topic 4</h4>
<h5>Topic 5</h5>
<h6>Topic 6</h6>
</body>
</html>

Output:




Example


Topic 1

Topic 2

Topic 3

Topic 4

Topic 5
Topic 6

Explanation:
Here, we are checking the behavior of all the six heading tags of HTML. All the six heading tags of HTML can also be used with the nested elements.

Please follow and like us:
error
Posted in HTML   









Copyright © 2019 CodesJava DMCA.com Protection Status