Topic: HTML5 Tags ReferencePrev|Next
<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.
|Content:||Block, inline, and text|
|Start/End Tag:||Start tag: required, End tag: required|
|Version:||HTML 3.2, 4, 4.01, 5|
<div> element is ideal for grouping elements for associating the styles and scripts (using the
id attributes), since it doesn't convey any meaning about its contents and also doesn't have any default styling or meaning.
The basic syntax of the
<div> tag is given with:
The example below shows the
<div> tag in action.
ExampleTry this code »
<div class="welcome-box"> <h1>Welcome</h1> <p>Hi, welcome to our website.</p> </div>
The following table shows the attributes that are specific to the
||Obsolete Aligns the content inside a div element.|
Like all other HTML tags, the
<div> tag supports the global attributes in HTML5.
<div> tag also supports the event attributes in HTML5.
<div> tag is supported in all major modern browsers.
See tutorial on: HTML Layout, CSS Alignment.