The Web Design Group

div - Generic Block-level Container

Syntax <div>...</div>
Attribute Specifications
  • align=[ "left" | "center" | "right" | "justify" ] (horizontal alignment)
  • common attributes
Contents Inline elements, block-level elements
Contained in applet, blockquote, body, button, center, dd, del, div, fieldset, form, iframe, ins, li, map, noframes, noscript, object, td, th

The div element defines a generic block-level container, allowing authors to provide style or language information to blocks of content. The element may contain any inline or block-level element, including another div.

The div element is most useful in combination with the class, id, or lang attributes. For example, a navigation bar could be contained within a div marked as class=navbar, allowing the author to use style sheets to easily change the background of all navigation bars on a site, or to eliminate navigation bars when printing.

The deprecated align attribute suggests the horizontal alignment for the content of the division on visual browsers. Possible values are left, right, center, and justify. <center> is a slightly better-supported alias for <div align="center">, though both methods of centering are deprecated in favor of style sheets, which provide greater flexibility in suggesting alignment.

span is a text-level equivalent of div for use within paragraphs and inline elements.

More Information