Tag Description
The div element is used to define a division or section in an HTML document. It is most often used to group elements to format them with styles.
This tag has the form:
<div>
html elements
</div>
Note: Most browsers place a line break before and after the div element.
HTML5 and HTML4.01 Differences
The "align" attribute was deprecated in HTML4.01, and is not supported in HTML5.
Attributes
Attribute | Value | Description |
---|---|---|
align | left
right center justify |
Specifies the alignment of a heading
HTML4:
![]() HTML5:
![]() |
Global Attributes
This tag also supports the HTML Global Attributes.
Event Attributes
This tag also supports the HTML Event Attributes.
Examples
The following example shows the basic use of this tag:
<div id="sidebar" align="right">"
<h1>Sidebar Heading</h1>
<p>Sidebar text</p>
</div>
Browser Support
Chrome | Firefox | IE | Safari | Opera |
---|---|---|---|---|
Doctype Declaration Support
The following table lists the doctype declarations this element may appear in:
HTML4.01 / XHTML1.0 | XHTML 1.1 | HTML 5 | ||
---|---|---|---|---|
Traditional | Strict | Frameset | ||
Miscellaneous Information
Defined In: | HTML 3.2 |
---|---|
Empty Tag: | No |