Search w3schools.com:

SHARE THIS PAGE

HTML <h1> to <h6> align Attribute

HTML h1 to h6 Tag Reference HTML <h1 to h6> tag

Example

A center-aligned HTML heading:

<h1 align="center">This is heading 1</h1>

Try it yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The align attribute is supported in all major browsers.


Definition and Usage

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

The align attribute of <h1> to <h6> is deprecated in HTML 4.01.

The align attribute specifies the horizontal alignment of a heading.


Compatibility Notes

The align attribute of <h1> to <h6> is deprecated in HTML 4.01. 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 Reference HTML <h1 to h6> tag

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]