This is a heading in a div element.

">

This is a heading in a div element.

" />
Easy Tutorial
❮ Av Prop Currentsrc Att Iframe Longdesc ❯

HTML <div> Tag

Example

A section in the document will be displayed in blue:

<div style="color:#0000FF">
  <h3>This is a heading in a div element.</h3>
  <p>This is some text in a div element.</p>
</div>

Browser Support

All major browsers support the <div> tag.


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


Tips and Notes

Tip: The <div> element is often used with CSS for layout purposes.

Note: By default, browsers usually place a line break before and after a <div> element. However, this can be changed using CSS.


Differences Between HTML 4.01 and HTML5

The align attribute is not supported in HTML5.

In HTML 4.01, the align attribute is deprecated.


Attributes

Attribute Value Description
align left <br>right <br>center <br>justify Not supported in HTML5. Deprecated in HTML 4.01. Specifies the alignment of the content inside a <div> element.

Global Attributes

The <div> tag supports HTML's global attributes.


Event Attributes

The <div> tag supports HTML's event attributes.


Related Articles

HTML Tutorial: HTML Layout

❮ Av Prop Currentsrc Att Iframe Longdesc ❯