` element was historically used to control the horizontal alignment of the content inside a division block.
> **β οΈ Deprecation Notice:** The `align` attribute is **deprecated** in HTML 4.01 and is **not supported** in HTML5. Modern web development practices require using CSS instead of this attribute to handle layout and alignment.
---
## Definition and Usage
The `align` attribute specifies the horizontal alignment of inline content (such as text and images) within a `
` element.
Because HTML is designed to structure content rather than style it, this presentational attribute has been phased out in favor of the CSS `text-align` property.
---
## Syntax
```html
```
### Attribute Values
| Value | Description |
| :--- | :--- |
| `left` | Left-aligns the content inside the `
` (Default). |
| `right` | Right-aligns the content inside the `
`. |
| `center` | Centers the content inside the `
`. |
| `justify` | Stretches the lines so that each line has equal width (similar to newspaper and magazine layouts). |
---
## Code Examples
### Legacy HTML Example (Deprecated)
Below is an example of how the `align` attribute was used in older HTML versions to center-align text inside a division block:
```html
```
### Modern CSS Alternative (Recommended)
To align content in modern web development, you should use the CSS `text-align` property. This can be applied via inline styles, internal stylesheets, or external stylesheets.
#### Using Inline CSS:
```html
```
#### Using External/Internal CSS (Best Practice):
```html
```
---
## Browser Support
While all major desktop and mobile browsers (including Chrome, Firefox, Safari, Edge, and Opera) still support the `align` attribute for backward compatibility with legacy websites, you should avoid using it in new projects to ensure your code complies with modern web standards.
---
## Summary of CSS Alternatives
To replace the deprecated `align` attribute, use the following CSS equivalents:
* **Left Align:** `text-align: left;`
* **Right Align:** `text-align: right;`
* **Center Align:** `text-align: center;`
* **Justify:** `text-align: justify;`
This text is centered using the deprecated HTML align attribute.
This text is centered using modern inline CSS.
This text is centered using a CSS class.
YouTip