<DIV> and </DIV>

Description Attributes Examples

Description:

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.

Attributes:

align=alignment
Determines how to align the <DIV>. May have the following values:

CENTER Center the section
LEFT Align to the left
RIGHT Align to the right
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.

Examples:

<DIV ALIGN=CENTER>
This shows how to use this tag to center a paragraph.<p>

Notice that everything between the tags is centered.<p>
</DIV>

 
This shows how to use this tag to center a paragraph.

Notice that everything between the tags is centered.

 

Internet Tips Contents
404 Errors Advertising Autoresponse Awardmaster Basics Browsers Careers Chatting Disasters Domains Email Emoticons Ezines Free Stuff Fun Stuff FTP Graphics Homepages HTML Reference HTML Tutorial Interactive Legal Links Msg Boards Microsoft Money Multimedia Networks Newsgroups Newsletter Products RFC's Ringmaster Searches Security Sticky Sites Surfing TANSTAAFL Telnet Viral Webmaster Your System