HTML div align Attribute
HTML <div> tag
Definition and Usage
The align attribute specifies horizontal alignment of the
content of the div element.
Compatibility Notes
The align attribute of the div element was deprecated in HTML 4.01
and is not supported in XHTML 1.0 Strict DTD.
Use CSS instead.
CSS syntax: <div style="text-align:right">
In our CSS tutorial you can find more details about the
text-align property.
Syntax
Syntax Example
Attribute Values
Value |
Description |
left |
Text is left-aligned. |
right |
Text is right-aligned. |
center |
Text is center-aligned. |
justify |
Text is justified. |
Browser Support

The attribute is deprecated, but still supported in all major browsers.
Example
Source |
Output |
<div align="right">
<p>Hello World</p>
</div>
|
|
Try-It-Yourself Demos
div align
attribute example
Set the div text alignment with the caption align attribute.
In CSS:
div text alignment example
Set the div text alignment with CSS.
HTML <div> tag
Whether you're new to XML or already an advanced user, the user-friendly views
and powerful entry helpers, wizards, and debuggers in XMLSpy are designed to
meet your XML and Web services development needs from start to finish.
- XML editor
- Graphical XML Schema / DTD editors
- XSLT 1.0/2.0 editor, debugger, profiler
- XQuery editor, debugger, profiler
- Support for Office Open XML (OOXML)
- Graphical WSDL editor & SOAP debugger
- Java, C#, C++ code generation
- And much more!
Download a fully functional free 30-day trial today!
|