HTML align Attribute specifies the alignment of content of HTML Element. Mostly it was used for the text content of HTML Tag.
Table of Contents
Syntax of HTML align Attribute
The Syntax of HTML align Attribute is shown below.
<div align="left">Text.</div>
Usage of HTML align Attribute
HTML align Attribute is used to set the alignment of the text content of HTML Tag.
HTML align Attribute was deprecated in HTML5, use CSS instead.
Used For
HTML align Attribute was used for following tags.
Tag Name |
---|
HTML div Tag |
HTML p Tag |
HTML col Tag |
HTML colgroup Tag |
HTML table Tag |
HTML tbody Tag |
HTML td Tag |
HTML tfoot Tag |
HTML th Tag |
HTML thead Tag |
HTML tr Tag |
HTML applet Tag |
HTML img Tag |
HTML iframe Tag |
HTML hr Tag |
HTML caption Tag |
Example of HTML align Attribute
Simple example of HTML align Attribute is given below.
<p align="left">This is Main Text.</p>
In above example we have used HTML align Attribute to align text content of p tag to the left.
Values of HTML align Attribute
Following values can be used with HTML align Attribute.
Value | Description |
---|---|
left | Align content to the left. |
right | Align content to the right. |
center | Align content to the center. |
justify | It makes sure that width of all lines is equal. |
Browser Support for HTML align Attribute
HTML align Attribute is supported by following major browsers.
Browser Name | Version |
---|---|
Chrome | All |
Firefox | All |
Opera | All |
IE / Edge | All |
Safari | All |