Description

The <div> (short for division) tag is generic container for flow content, which has no default rendering or meaning. The <div> tag is extensively used to define the structural sections of a document and to layout a web page using CSS.

The following table summarizes the usages context and the version history of this tag.

Placement:Block
Content:Block, inline and text
Start/ End Tag:Start tag: required , End tag: required
Version:HTML 3.2, 4, 4.01, 5

Tip: The <div> element is ideal for grouping elements for associating the styles and scripts (using the `class` or `id` attributes), since it doesn't convey any meaning about its contents and also doesn't have any default styling or meaning.

Syntax

The basic syntax of the <body> tag is given with:

HTML/XHTML: <div> ... </div>

The example below shows the <div> tag in action.

<div class="welcome-box">
    <h1>What is HTML?</h1>
    <p>HTML is a markup language for describing the structure of web pages.</p>
</div>

Tag-Specific Attributes

The following table shows the attributes that are specific to the <div> tag.

Global Attributes

Like all other HTML tags, the <div> tag supports the global attributes in HTML5.

Event Attributes

The <div> tag also supports the event attributes in HTML5.

Browser Compatibility

Element
<div>YesYesYesYesYes