div

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 &lt;p&gt;, &lt;table&gt;. You name it!</p>
</div>

Result

Any kind of content here. Such as <p>, <table>. You name it!

Browser compatibility

  • Desktop
  • Mobile

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 (Yes) (Yes) (Yes) (Yes)
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes) (Yes) (Yes)

See also

Tags (4)

Edit tags

Attachments (0)

 

Attach file