Main Index |
Top Of Tree |
Tag Index |
Tag History
- What is it?
- The DIV tag is used to differentiate content by using a CLASS
attribute to the tag. The CLASS value would indicate the TYPE
of container (the semantic nature of the division) the text was in,
such as a chapter, a section or appendix, etc. DIV is also a catch-all
Block Formatting tag with an implied line
break before and after.
Within the realm of Style Sheets, this tag is nestable to allow hierarchies of
sections, subsections or chapters to be defined. This nesting ability
also allows for more powerful Style Sheet mechanisms. One such powerful
benefit is overlaid text: although the
CSS1 specification
does not explicitly mention it, nested divisions can render content on
top of one another if layout properties are correctly
set and the browser correctly supports negative margin definitions (keep
in mind that while this effect can create nice visual effects, it degrades
poorly in non-supporting browsers.)
For more information on Style Sheets, please see the
Style Sheet Guide.
- Attributes
- Align
- 2 | 3
| 3.2 | IE3A1
| M | N2
- Required? No
- Description:
This indicates the horizontal alignment of the Division block text in
the browser window. These values can be over-ridden by style sheets
values.
- Values:
Left [DEFAULT] |
Center | Right |
Justify
Style Sheet Attributes
[More on Cascading Style Sheets]
- Class
- 2 | 3
| 3.2 | IE3B1
| M | N4B2
- Required? No
- Description:
This represents an assigned semantic classification grouping(s) for the
current tag.
- Values:
Given as a comma separated list of alphanumeric characters. Class names
may contain spaces (multiple consecutive spaces treated as a single
space.)
- ID
- 2 | 3
| 3.2 | IE3B1
| M | N4B2
- Required? No
- Description:
This assigns an alpha-numeric identifier that is unique
to this tag instance. Style sheets may use this attribute to reference
the current instance of this tag. Hyperlinks may also use this identifier
to serve as a destination.
- Values:
An alphanumeric string - initial character must be a letter followed
by alphabetic characters, digits, "-" or "."
characters. The allowable set of alpha-characters is restricted to the
A-Z and a-z set.
- Style
- 2 | 3
| 3.2 | IE3B1
| M | N4B3
- Required? No
- Description:
This attribute is a text string that provides rendering style
information for the current tag.
- Values:
Please see the description of
inline styles for more
information on how to use this attribute and its
possible values.
- Example
- <div ALIGN="right" CLASS="greensection" STYLE="color: lime">text</div>
- Parent Model
- %Block Format
Parent% |
%Multimedia
Parent% |
<Body> |
<Basefont>
- Content Model
- %Text% |
%Anchors% |
%Virtual Formatting% |
%Physical Formatting% |
%Line Break Content% |
%Multimedia Content% |
%Block Content% |
<address> |
<basefont> |
<Hx>
Tips & Tricks
- The DIV tag is an all-purpose, generalized HTML
Block Structure. Use this tag when you wish
to define a block or section of Styled text, and
SPAN when you wish to create a generalized
Character Formatting element.
- Note that the DIV element was not listed in the
Block Formatting section, even though it is a
Block Level tag. This is because DIV is a new HTML that is generic and
serves little purpose without Style information attached.
- DIV CLASSes can be nested. This allows for more powerful Style
Sheet mechanisms. Although the
CSS1 specification
does not explicitly mention it, overlaid text is possible using this
method. The advantages and potentials of overlaid text are enormous -
but understanding and creating such structures is not a simplistic matter.
- Use of the CENTER tag to center align
text in a block is still recommended slightly over use of DIV because
more browsers support it. This difference in support is quickly changing
though.
- Along the same lines,
HTML 3.2
classifies <center> as a shorthand
notation of <div
ALIGN="center">. This
effectively makes the CENTER tag a "subset" of DIV.
- DTD NOTE: Alignment attributes do not
react very well with the MULTICOL tag.
Browser Peculiarities
- The 'justify' value of the ALIGN attribute is currently only supported in
Netscape, versions 4.0 Beta 2 and above.
Boring Copyright Stuff...