The <DIV> tag is used to divide a document up into artificial sections such as chapters, sections, appendix and so on.
The difference between <DIV> and <SPAN> is that <SPAN> is used within a paragraph, sentence or even word, while <DIV> is intended for block-level formatting.
<DIV> is great to use with dynamic HTML, as it divides a page into sections which can be manipulated. You reference the <DIV>'s by using their name, specified by the ID.
<DIV> is also useful for defining areas of the document to be referenced by style sheets.
align=alignment |
|||||||
Determines how to align the <DIV>. May have the
following values:
|
|||||||
class=class |
|||||||
Indicates that the <DIV> is to be formatted using the specified class. |
|||||||
| dir=direction | |||||||
Indicates the direction (right or left) that the text is to be displayed. Useful for languages which display left to right. |
|||||||
event=JavaScript |
|||||||
| When event occurs, execute the specified JavaScript. | |||||||
id = "name" |
|||||||
You can give a <DIV> a name, which allows it to be referenced and changed in a script (dynamic HTML). |
|||||||
| lang="lang" | |||||||
| Indicates the language of the text within the <DIV>. | |||||||
nowrap |
|||||||
Prevents the browser from wrapping except if there is an explicit <BR>. |
|||||||
style="style" |
|||||||
Defines the style in which the <DIV> will be displayed. This overrides any style elements at an "outer" level, such as from the BODY or the Cascading Style Sheet. |
|||||||
title="title" |
|||||||
You can give a <DIV> a title if you want. This provides some additional information about the paragraph. I'm not sure why you would want to do this, but you could. |
|||||||
<DIV
ALIGN=CENTER>
|
Notice that everything between the tags is centered.
Unless otherwise noted, all photos and text is Copyright © Richard G Lowe, Jr.