HTML XHTML The Complete Reference
home » reference » appendix a » html element reference

<div> (Division)


This element indicates a block of document content, which should be treated as a logical unit and will have no default rendering or meaning.

Standard Syntax


<div
align="center | justify | left | right" (transitional only)
class="class name(s)"
dir="ltr | rtl"
id="unique alphanumeric identifier"
lang="language code"
style="style information"
title="advisory text"
</div>

Attributes Defined by Internet Explorer


accesskey="key" (5.5)
contenteditable="false | true | inherit" (5.5)
disabled="false | true" (5.5)
hidefocus="true | false" (5.5)
language="javascript | jscript | vbs | vbscript" (4)
nowrap="no | yes" (4)
tabindex="number" (5.5)
unselectable="on | off" (5.5)

Standard Events


onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

Events Defined by Internet Explorer


onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate, onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy, oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture, onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange, onreadystatechange, onresizeend, onresizestart, onselectstart, ontimeerror

Element Specific Attributes


align
This attribute indicates how the tagged text should be horizontally aligned on the page. The default value is left. The justify value is supported only by the Microsoft implementation.

nowrap
This Internet Explorer–specific attribute is used to control the wrapping of text within a <div> tag. If set to yes, text should not wrap. The default is no. CSS rules should be used instead of this attribute.

Examples


<div class="special" id="div1" style="background: yellow">
Get ready to animate and stylize this.
</div>

Compatibility


HTML 3.2, 4, 4.01, XHTML 1.0, 1.1, Basic
Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 2, 3, 4- 4.7, 6, 7
Opera 4-7

Notes


A <div> tag is a generic block tag and is very useful for binding scripts or styles to an arbitrary section of a document. It complements <span>, which is used inline.

The HTML 4.01 specification specifies that the datafld, dataformatas, and datasrc attributes are reserved for <div> and might be supported in the future. They were removed from XHTML but Internet Explorer supports them for data binding.

Under the HTML 4.01 strict specification, the align attribute is not supported.

HTML 3.2 supports only the align attribute.

(X)HTML Elements
CSS Properties
Previous: dir Next: dl
< Home | About | Chapters | Examples | Errata | Reference | Site Map >