Answers Search Help
Boston University home page
HTML: Intermediate
 
 
    Site Management
 
 
    Linking
 
 
 
 
 
 
    HTML Lists
 
 
 
 
    Tables
 
 
 
 
 
 
    Special Characters
 
 
    Supplementary
 
 
 
    Also See
   
   
   

Alignment Options

The division tag is an easy way to specify alignment options for large sections of your document.

You are required to use both an opening and a closing tag:

<div> - opening tag
</div> - closing tag

The alignment options you can use in a DIV tag are right, left, center, and justify (version 4 browsers only). The alignment will be applied to all text and graphics between the opening and closing tags.

Code Example:

<div align="right">Here is some text inside a DIV tag with the alignment option set to "right."<br>
<p>
Text with line breaks -- as well as text inside paragraphs -- will all be aligned to the right side of the screen in this example.</p>
<ul>
<li>
The Div tag can</li>
<li>even change the</li>
<li>alignment of your lists!</li>
</ul></div>

Result:

Here is some text inside a DIV tag with the alignment option set to "right."

Text with line breaks -- as well as text inside paragraphs -- will all be aligned to the right side of the screen in this example.

  • The Div tag can
  • even change the
  • alignment of your lists

The Div tag is also an integral part of Cascading Style Sheets, which when fully implemented on the Web and in Web browsing software, will make text and layout formatting much less tedious!

 

WebCentral Using Publishing Learning Training Consulting WebCentral
Answers Search Help
NIS  |  OIT  |  Boston University  |   January 9, 2007