h1, h2, h3, h4, h5, h6 HTML

HTML <h1> to <h6> Tags

An HTML heading is a tag that 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 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 headings. 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 support 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</h4>
<h6>Topic 6</h6>
</body>
</html>

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.

Tag Specific Attributes:

Attribute Value Uses
align left

center

right

justify

Used to define the alignment of a heading. Not supported in HTML 5.

Global Attributes:

The HTML GLobal attributes are supported by the HTML <h1> to <h6> tags.

Event Attributes:

The HTML Event attributes are supported by the HTML <h1> to <h6> tags.

Supporting Browsers:

Chrome, IE, Firefox, Opera, and Safari.

Please follow and like us:
Content Protection by DMCA.com