<DIV> | NN all IE all HTML 3.2 | ||||
<DIV>...</DIV> | HTML End Tag: Required | ||||
The div element gives structure and context to any block-level content in a document. Unlike some other structural elements that have very specific connotations attached to them (the p element, for instance), the author is free to give meaning to each particular div element by virtue of the element's attribute settings and nested content. Each div element becomes a generic block-level container for all content within the required start and end tags. It is most convenient to use the div element as a wrapper for multielement content that is to be governed by a single style sheet rule. For example, if a block of content includes three paragraphs, rather than assign a special font style to each of the p elements, you can wrap all three p elements with a single div element whose style sheet defines the requested font style. Such a style sheet could be defined as an inline style attribute of the div element or assigned via the class or id attribute, depending on the structure of the rest of the document. div elements are block-level elements. If you need an arbitrary container for inline content, use the span element, instead. |
|||||
Example | |||||
<DIV class="sections" id="section3">...</DIV> |
|||||
Object Model Reference | |||||
[window.]document.getElementById(elementID)
|
|||||
Element-Specific Attributes | |||||
|
|||||
Element-Specific Event Handler Attributes | |||||
None. |
align | NN 2 IE 3 HTML 3.2 |
align="alignmentConstant" | Optional |
See details for horizontal alignment within a block element in the Section 8.1.5 at the beginning of this chapter. |
|
Example | |
<DIV align="center">Part IV</DIV> |
|
Value | |
Constant value. Navigator 4 and later and Internet Explorer 4 and later (Windows) recognize all four constants specified in loose HTML 4: center | left | right | justify. IE 4 for the Macintosh does not recognize the justify setting. |
|
Default | |
left or right, depending on direction of current language. |
|
Object Model Reference | |
[window.]document.getElementById(elementID).align
|
datafld | NN n/a IE 4 HTML |4| |
datafld="columnName" | Optional |
Used with IE data binding to associate a remote data source column name with the HTML content of a div element. The data source column must be HTML (see dataformatas). datasrc and dataformatas attributes must also be set for the div element. Works only with text file data sources in IE 5/Mac. This attribute was reserved in HTML 4, but was dropped in XHTML 1.0. |
|
Example | |
<DIV datasrc="DBSRC3" datafld="sec3" dataformatas="HTML"></DIV> |
|
Value | |
Case-sensitive identifier. |
|
Default | |
None. |
|
Object Model Reference | |
[window.]document.getElementById(elementID).dataFld
|
dataformatas | NN n/a IE 4 HTML |4| |
dataformatas="dataType" | Optional |
Used with IE data binding, this attribute advises the browser whether the source material arriving from the data source is to be treated as plain text or as tagged HTML. A div element should receive data only in HTML format. Works only with text file data sources in IE 5/Mac. This attribute was reserved in HTML 4, but was dropped in XHTML 1.0. |
|
Example | |
<DIV datasrc="DBSRC3" datafld="sec3" dataformatas="HTML"></DIV> |
|
Value | |
IE recognizes two possible settings: text | html |
|
Default | |
text |
|
Object Model Reference | |
[window.]document.getElementById(elementID).dataFormatAs
|
datasrc | NN n/a IE 4 HTML |4| |
datasrc="dataSourceName" | Optional |
Used with IE data binding to specify the ID of the page's object element that loads the data source object for remote data access. Content from the data source is specified via the datafld attribute. Works only with text file data sources in IE 5/Mac. This attribute was reserved in HTML 4, but was dropped in XHTML 1.0. |
|
Example | |
<DIV datasrc="DBSRC3" datafld="sec3" dataformatas="HTML"></DIV> |
|
Value | |
Case-sensitive identifier. |
|
Default | |
None. |
|
Object Model Reference | |
[window.]document.getElementById(elementID).dataSrc
|
lang | NN 3 IE 4 HTML 4 |
lang="languageCode" | Optional |
The language being used for the element's attribute values and content. A browser can use this information to assist in proper rendering of content with respect to details such as treatment of ligatures (when supported by a particular font or required by a written language), quotation marks, and hyphenation. Other applications and search engines might use this information to aid the selection of spell-checking dictionaries and the creation of indices. |
|
Example | |
<SPAN lang="de">Deutsche Bundesbahn</SPAN> |
|
Value | |
Case-insensitive language code. |
|
Default | |
Browser default. |
|
Object Model Reference | |
[window.]document.getElementById(elementID).lang
|
nowrap | NN n/a IE 4 HTML n/a |
nowrap | Optional |
The nowrap attribute, unique to IE/Windows for this element, overrides the normal block model for a div element. When the attribute is turned on, text streams to the right unless broken by other interlaced elements. Indiscriminate use may lead to excessively wide pages that force users to scroll horizontally over long distances. |
|
Example | |
<DIV id="bigBlock" nowrap>...</DIV> |
|
Value | |
The presence of the attribute sets its value to true. |
|
Default | |
false |
title | NN 6 IE 3 HTML 3.2 |
title="advisoryText" | Optional |
An advisory description of the element. For HTML elements that produce visible content on the page, IE 4 and later and Netscape 6 render the content of the title attribute as a tooltip when the cursor rests on the element for a moment. For example, the table-related col element does not display content, so its title attribute is merely advisory. To generate tooltips in tables, assign title attributes to elements such as table, tr, th, or td. The font and color properties of the tooltip are governed by the browser, and are not modifiable under script control. In IE/Windows, the tooltip is the standard small, light-yellow rectangle; in IE/Mac, the tooltip displays as a cartoon bubble in the manner of the Mac OS bubble help system. Netscape 6 tooltips are the same small rectangle on all OS versions. If no attribute is specified, the tooltip does not display. You can assign any descriptive text you like to this attribute. Not everyone will see it, however, so do not put mission-critical information here. Browsers designed to meet web accessibility criteria might use this attribute's information to read information about a link or nontext elements to vision-impaired web surfers. Therefore, don't ignore this potentially helpful aid to describing an element's purpose on the page. Although the compatibility listing for this attribute dates the attribute back to Internet Explorer 3 and HTML 3.2, it is newly ascribed to many elements starting with IE 4 and HTML 4.0. |
|
Example | |
<SPAN title="United States of America">U.S.A.</SPAN> |
|
Value | |
Any string of characters. The string must be inside a matching pair of (single or double) quotation marks. |
|
Default | |
None. |
|
Object Model Reference | |
[window.]document.getElementById(elementID).title
|