Table of contents
- 1. Summary
- 2. Usage context
- 3. Attributes
- 4. DOM interface
- 5. Examples
- 5.1.1. Result
- 5.2. Browser compatibility
- 6. See also
Summary
The Document Division (<div>) HTML element is generic container for flow content, which does not inherently represent anything. It can be used to group elements for styling purposes (using the class or id attributes), or because they share attribute values, such as lang. It should be used only when no other semantic element (such as <article>
or <nav>
) is appropriate.
Usage context
| Content categories | Flow content. |
| Permitted content | Zero or more <style>
elements, followed by flow content. |
| Tag omission | None, must have both a start tag and an end tag. |
| Permitted parent elements | Any element that accepts flow content. |
| Normative document | HTML 5, section 4.5.13; HTML 4.01, section 7.5.4 |
Attributes
Like all other HTML elements, this element has the global attributes.
In HTML5
, the align attribute on <div> is
Obsolete
.
DOM interface
This element implements the HTMLDivElement interface.
Examples
<div> <p>Any kind of content here. Such as <p>, <table>. You name it!</p> </div>
Result
Any kind of content here. Such as <p>, <table>. You name it!


Mozilla Developer Network