1. Home
  2. Computing & Technology
  3. Web Design / HTML

<div></div>

By , About.com Guide

<div> Description:

The <div> element defines logical divisions within the document. This means that when you use a <div> element, you are indicating that the enclosed content is a specific section of the page. The <div> element is typically used in XHTML+CSS documents to position portions of the page.

The <div> tag is a block-level element.

<div> Web Browser Support:
<div> Attributes:
<div> End Tag:
</div> REQUIRED
Contents:

The following tags are valid within the <div> tag:
a, acronym, address, applet, b, basefont, bdo, big, blockquote, br, button, center, cite, code, dfn, dir, div, dl, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, hr, i, iframe,

img, input isindex, kbd, label, map, menu, noframes, noscript, object, ol, p, pre, q, s, samp, script, select, small, span, strike, strong, sub, sup, table, textarea, tt, u, ul, var
<div> Valid Context:

The <div> tag is valid within the following tags:
blockquote, body, button, center, dd, div, fieldset, form, iframe, li, noframes, noscript, object, td, th

<div> Usage:
  • Style division
    <div style="color : #ff0000">red text</div>
  • Justified text
    <div align="justify">The following text will be justified across the width of the browser. This may not work reliably across all browsers, and can also be defined with style tags. Lorem ipsum sit dolor amet. Lorem ipsum sit dolor amet. Lorem ipsum sit dolor amet. Lorem ipsum sit dolor amet. Lorem ipsum sit dolor amet. Lorem ipsum sit dolor amet.</div>
<div> Special Notes:
  • As this is a block-level tag, most browsers will add extra spaces before and after the element, similar to the paragraph element.
  • This element is commonly used to layout Web pages with style sheets.
More <div> Information:

Return to XHTML Element (HTML Tags) Library

Explore Web Design / HTML
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Web Design / HTML

©2009 About.com, a part of The New York Times Company.

All rights reserved.