HTML5 <div> Tag

Example

A section in a document that will be displayed in green:

<div style="color:#0F710F">
  <h3>A header</h3>
  <p>A paragraph.</p>
</div>
Code it Online »

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-elements to format them with styles.

Differences Between HTML 4.01 and HTML5

The "align" attribute is deprecated in HTML 4.01, and not supported in HTML5. Use CSS to align the div's content.

Tips and Notes

Hint: The div element is very often used with CSS to layout a web page.

Note: Browsers usually place a line break before and after the div element.

Standard Attributes

The <div> tag also supports the Standard Attributes in HTML5.

Event Attributes

The <div> tag also supports the Event Attributes in HTML5.


Have Any Suggestion? We Are Waiting To Hear from YOU!

Your Query was successfully sent!