HTML <div>Tag
Examples
A section of the document will be displayed in blue:
<div style="color:#0000FF">
<h3>This is a heading in a div element.</h3>
<p>This is text in a div element.</p>
</div>
Try it Yourself »
Browser Support
![]()
All major browsers support the <div> tag.
Definition and Usage
The <div> tag defines a division or a section in an HTML document.
The <div> tag is often used to group block-level elements in order to format them with CSS.
Tips and Notes
Tip:The <div> element is often used with CSS to lay out web pages.
Note:By default, browsers usually place a line break before and after the <div> element. However, you can change this by using CSS.
Differences between HTML 4.01 and HTML5
The align attribute is not supported in HTML5.
In HTML 4.01, the align attributeis deprecated.。
Attributes
| Attribute | Value | Description |
|---|---|---|
| align | left right center justify |
Not supported in HTML5. Deprecated in HTML 4.01.Specifies the alignment of the content in the <div> element. |
Global Attributes
The <div> tag supportsHTML Global Attributes.。
Event Attributes
The <div> tag supportsHTML Event Attributes.。
Related Articles
HTML Tutorial:HTML Layout
Other Extensions