HTML5 <div> Tag

The HTML <div> tag is meant to be used as a generic container for flow content. It does not inherently represent anything. You can use this tag to group elements together for purposes such as styling (using the class or id attributes), marking a section of a document in a different language (using the lang attribute), and so on.

The only content permitted inside this element is flow content or (in WHATWG HTML), if the parent is a <dl> element: one or more <dt> elements followed by one or more <dd> elements, optionally intermixed with <script> and <template> elements.

Both the starting and ending tag are mandatory for this element. The parent of the <div> tag can be any element that accepts flow content or (in WHATWG HTML): the <dl> element.

The following style is applied to this element by default:

div {
  display: block;

Here is an example of using this tag:

  <p>You can put any kind of content here. 
     Such as a <video> or <table>.   


This element only accepts global attributes.


See the Pen HTML div Tag by Tutorialio (@tutorialio) on CodePen.

Further Reading

  1. Read more about the HTML <div> element on MDN.
  2. You can also read the HTML <div> tag reference on W3C.

Reader Comments

1. You can register or login to post a comment. Asking readers to register improves the quality of discussion.

2. As a registered user, you will also get to access features like choosing between a light and dark theme or anything else that we might implement in future.

Follow Us For Updates

Go To Top