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.
- Netscape 2, 3, 4, 6, 7
- Mozilla 1
- Firefox 1
- Internet Explorer 3, 4, 5, 6
- Opera 3, 4, 5, 6, 7, 8
- Safari 1
- WebTV/MSN TV
- AvantGo Palm OS
- AvantGo Windows CE
- HTML 4.0
- XHTML 1.0: XHTML Text Module
- align (optional)
- class (optional)
- dir (optional)
- id (optional)
- lang (optional)
- onclick (optional)
- ondblclick (optional)
- onkeydown (optional)
- onkeypress (optional)
- onkeyup (optional)
- onmousedown (optional)
- onmousemove (optional)
- onmouseout (optional)
- onmouseover (optional)
- onmouseup (optional)
- style (optional)
- title (optional)
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,
The <div> tag is valid within the following tags:
blockquote, body, button, center, dd, div, fieldset, form, iframe, li, noframes,
noscript, object, td, th
- 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>
- 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.

