Open In App

HTML <h1> to <h6> align Attribute

Last Updated : 29 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
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:

Attribute Description
left It sets the content to the left-align. By default, it is aligned to the left.
right It sets the content to the right align.
center It sets the div element to the center.
justify In 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

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads