English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

Comprehensive HTML tag list

HTML: h1 – h6 align Attribute

This article introduces HTML h1 – h6 The align attribute specifies the horizontal alignment of the heading, with online examples demonstrating how to use HTML h1 – h6 Detailed information about the align attribute, browser compatibility, syntax definition, and its attribute values.

 HTML <h1-h6Tag

Online Example

Centered, left, and right aligned 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>
<h5 align="justify">This is heading 5</h5>
<h6 align="justify">This is heading 6</h6>
Test to see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the align attribute.

Definition and Usage

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

In HTML 4.01 In1> - <h6> The align attribute is deprecated.

The align attribute specifies the horizontal alignment of the title.

Compatibility Note

<h1> - <h6> The align attribute is deprecated. Use CSS instead.

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

CSS Example: Set the alignment of the title

In our CSS tutorial, you can find more abouttext-align Attributedetails.

Syntax

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

Attribute Value

ValueDescription
leftLeft align the title (default value).
rightRight align the title.
centerCenter align the title.
justifyTitles have reasonable margins.
 HTML <h1-h6Tag