<!-- Please follow this checklist and put an x in each of the boxes, like this: [x]. It will ensure that our team takes your pull request seriously. --> - [x] I have read [freeCodeCamp's contribution guidelines](https://github.com/freeCodeCamp/freeCodeCamp/blob/master/CONTRIBUTING.md). - [x] My pull request has a descriptive title (not a vague title like `Update index.md`) - [x] My pull request targets the `master` branch of freeCodeCamp.
44 lines
1.4 KiB
Markdown
44 lines
1.4 KiB
Markdown
---
|
|
title: Div Align Attribute
|
|
---
|
|
## Div Align Attribute
|
|
|
|
The `<div align="">` attribute is used for aligning the text in a div tag to The Left, Right, center or justify.
|
|
|
|
For instance:
|
|
|
|
```html
|
|
<html>
|
|
<head>
|
|
<title> Div Align Attribbute </title>
|
|
</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!
|
|
This attribute is no longer supported in html5. css is the way to go.
|
|
|
|
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.
|
|
|
|
```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
|
|
|