Open In App

HTML <h1> to <h6> align Attribute

Last Updated : 29 Jan, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The HTML <h1> to <h6> align Attribute is used to specify the alignment of the <h> element or the content present inside the Heading Element.

Note: This attribute is not supported by HTML5.

Syntax:

<h1 align="left | right | center | justify">

Attribute Values:

AttributeDescription
leftIt sets the content to the left-align. By default, it is aligned to the left.
rightIt sets the content to the right align.
centerIt sets the div element to the center.
justifyIn this heading is justified to both margins

Example: This example shows the implementation of align Attribute of heading.

html
<!DOCTYPE html>
<html>

<body>

    <h1 align="center">center</h1>
    <h2 align="left">left 2</h2>
    <h3 align="right">right 3</h3>
    <h4 align="justify">justify</h4>

</body>

</html>

Output :

HTML DOM Property

HTML DOM Heading align Property

Supported Browsers:

  • Google Chrome 1
  • Edge 12
  • Firefox 1
  • Apple Safari 15
  • Opera 4

Next Article

Similar Reads