HTML
-
The align attribute
Example
A centered HTML heading:
This is heading 1
This is heading 2
This is heading 3
This is heading 4
Try it »
Browser support





All major browsers support the align attribute.
Definition and Usage
HTML5 does not support
-
the align attribute. Please use CSS instead.
In HTML 4.01,
-
The align attribute is deprecated.
The align attribute specifies the horizontal alignment of the heading.
Compatibility notes
-
The align attribute is deprecated. Please use CSS instead.
CSS syntax:
CSS example: setting the alignment of headings
In our CSS tutorial, you can find more details about The text-align propertydetails.
Syntax
Attribute values
| Value | Description |
|---|---|
| left | Left-align the heading (default). |
| right | Right-align the heading. |
| center | Center-align the heading. |
| justify | The heading has justified margins. |
HTML