HTML <h1> - <h6> alignAttribute

HTML h1-h6 标签参考手册HTML <h1-h6> Tag

Examples

Centered HTML headings:

<h1 align="center">This is heading 1</h1>
<h2 align="left">This is heading 2</h2>
<h3 align="right">This is heading 3</h3>
<h4 align="justify">This is heading 4</h4>

Try it yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the align attribute.


Definition and Usage

HTML5 does not support the <h1> - <h6> align attribute. Use CSS instead.

In HTML 4.01, the align attribute of <h1> - <h6>is deprecated。

The align attribute specifies the horizontal alignment of headings.


Compatibility Notes

The align attribute of <h1> - <h6> is deprecated. 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 aboutthe text-align attributedetails.


Syntax

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

Attribute Values

Value Description
left Left-align heading (default).
right Right-align heading.
center Center-align heading.
justify Justify heading.


HTML h1-h6 标签参考手册HTML <h1-h6> Tag Other Extensions