2018-10-12 19:37:13 +00:00
---
title: Div Align Attribute
---
## Div Align Attribute
2018-11-21 00:12:30 +00:00
The `<div align="">` attribute is used for aligning the text in a div tag to the left, right, center or justify.
2018-10-12 19:37:13 +00:00
For instance:
```html
< html >
< head >
2018-11-21 00:12:30 +00:00
< title > Div Align Attribute < / title >
2018-10-12 19:37:13 +00:00
< / head >
< body >
< div align = "left" >
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
< / div >
< div align = "right" >
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
< / div >
< div align = "center" >
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
< / div >
< div align = "justify" >
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
< / div >
< / body >
< / html >
```
## Important!
2018-11-21 00:12:30 +00:00
This attribute is no longer supported in html5. CSS is the way to go.
2018-10-12 19:37:13 +00:00
2018-11-21 00:12:30 +00:00
The `<div align="">` attribute can be used to horizontally align the contents within a div. In the below example, the text will be centered within the div.
2018-10-12 19:37:13 +00:00
```html
< div align = "center" >
This Text Will Be Centered
< / div >
```
**This attribute is not supported in HTML5 and [CSS Text Align ](https://github.com/freeCodeCamp/guides/blob/f50b7370be514b2a03ee707cd0f0febe2bb713ae/src/pages/css/text-align/index.md ) should be used instead