THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML <h1> to <h6> align Attribute

❮ HTML <h1 to h6> tag

Example

A center-aligned HTML heading:

<h1 align="center">This is heading 1</h1>
Try it Yourself »

Definition and Usage

The align attribute specifies the horizontal alignment of a heading.


Browser Support

Attribute
align Yes Yes Yes Yes Yes

Compatibility Notes

The align attribute of <h1> to <h6> is not supported in HTML5. Use CSS instead.

CSS syntax: <h1 style="text-align:right">

CSS Example: Set the alignment of headings

In our CSS tutorial you can find more details about the text-align property.


Syntax

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

Attribute Values

Value Description
left Left-aligns the heading
right Right-aligns the heading
center Center-aligns the heading
justify The heading is justified to both margins

❮ HTML <h1 to h6> tag