HTML Tag Reference - HTML tag div








The <div> element stands for division and is used to segregate a group of elements.

Browser compatibility

<div> Yes Yes Yes Yes Yes

What's new in HTML5

The align attribute is deprecated in HTML5.

Attribute

align
Value:left|right|center|justify
Not supported in HTML5. Align the content.

Global Attributes

The <div> tag supports the Global Attributes in HTML.

Event Attributes

The <div> tag supports the Event Attributes in HTML.





Default CSS Settings

div {
    display: block;
}

Example

A demo showing how to use <div> tag.

<html>
<body>
     <div style="background-color: #CCFFCC; border: 1px none #000000;">
          <p>This div element contains only text.</p>
     </div>
</body>
</html>

Click to view the demo