Click Here!
home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Platinum Edition Using HTML 4, XML, and Java 1.2
(Publisher: Macmillan Computer Publishing)
Author(s): Eric Ladd
ISBN: 078971759x
Publication Date: 11/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


<BR>

Type:

Standalone

Function:

Inserts a line break in the document. Carriage returns in the HTML code do not translate to line breaks on the browser screen, so authors often need to insert the breaks themselves. The <BR> tag is indispensable when rendering text with frequent line breaks, such as addresses or poetry. Unlike the <P> tag or the heading tags, <BR> adds no additional vertical space after the break.

Syntax:

<BR CLEAR=”LEFT|RIGHT|ALL”>

Attributes:

The CLEAR attribute tells which margin to break to when breaking beyond a floating page element, such as an image (see Figure 3.9). Setting CLEAR=”LEFT” breaks to the first line in the left margin free of the floating object. CLEAR=”RIGHT” breaks to the first clear right margin, and CLEAR=”ALL” breaks to the first line in which both the left and right margins are clear.


FIGURE 3.9  The <BR> tag can break to the next line or to the next line that is free of floating objects such as images or tables.

Example:

First Name: <INPUT TYPE=”TEXT” NAME=”fname”><BR>
Last Name: <INPUT TYPE=”TEXT” NAME=”lname”><BR>
Telephone: <INPUT TYPE=”TEXT” NAME=”phone”><BR>
Email: <INPUT TYPE=”TEXT” NAME=”email”>

<CENTER>

Type:

Container

Function:

Centers all text and other page components it contains.

Syntax:

<CENTER> ... centered page components go here ... </CENTER>

Attributes:

None.

Example:

<CENTER>
<I>A Midsummer Night’s Dream</I><BR>
by William Shakespeare
</CENTER>


NOTE:  The W3C has deprecated the <CENTER> tag in favor of using the <DIV ALIGN=”CENTER”> tag (see the following tag) or style sheets for centering.

<DIV>

Type:

Container

Function:

Defines a section or division of a document that requires a special alignment.

Syntax:

<DIV ALIGN=”LEFT|RIGHT|CENTER|JUSTIFY”>
...
</DIV>

Attributes:

The ALIGN attribute controls how text contained between the <DIV> and </DIV> tags is aligned. You can set ALIGN equal to LEFT, RIGHT, CENTER, or JUSTIFY, depending on the kind of alignment you need.

Example:

<DIV ALIGN=”RIGHT”>
Everything in this section is right-justified.  Hard to read, isn’t it?
...
</DIV>

<HR>

Type:

Standalone

Function:

Places a horizontal line on the page (see Figure 3.10).


FIGURE 3.10  Horizontal rules are a great way to break up a page and give the readers’ eyes a rest.

Syntax:

<HR ALIGN=”alignment” NOSHADE SIZE=”thickness”
WIDTH=”pixels_or_percentage_of_screen”>

Attributes:

The unmodified <HR> tag places a line, 1 pixel thick, across the page. The line will have a shading effect to give the illusion of being three-dimensional. You can change how the default line is displayed by using combinations of the following attributes:

  ALIGN—You can set ALIGN equal to LEFT, RIGHT, or CENTER to change how the horizontal line is aligned on the page. Note that this matters only when you’ve changed the width of the line to be something less than the browser screen width. The default value of ALIGN is CENTER.
  NOSHADE—Placing the NOSHADE attribute in an <HR> tag suppresses the shading effect and yields a solid line.
  SIZESIZE controls the thickness of the line. You set SIZE equal to the number of pixels in thickness you’d like the line to be.
  WIDTH—A line’s WIDTH can be specified in one of two ways. You can set it equal to a number of pixels, or you can set it equal to a percentage of the user’s browser screen width (or table cell, if you’re placing a line inside a cell). Because you can’t know the screen resolution settings of every user, you should use the percentage approach whenever possible.

All the attributes of the <HR> tag have been deprecated in favor of using style sheets to control horizontal rule properties.

Example:

<HR NOSHADE WIDTH=80% SIZE=4>
<DIV ALIGN=”CENTER”>Return to the Home Page</DIV>
<HR NOSHADE WIDTH=80% SIZE=4>

<H1>–<H6>

Type:

Container

Function:

Establishes a hierarchy of document heading levels. Level 1 has the largest font size. Increasing through the levels causes the font size to decrease. All headings are rendered in boldface and have a little extra line spacing built in above and below them (see Figure 3.11).


NOTE:  Although the headings’ tags are meant to be used in a strictly hierarchical fashion, many authors use them out of sequence to achieve the formatting effects they want.

Syntax:

<Hn ALIGN=”LEFT|RIGHT|CENTER|JUSTIFY”> ... Level n heading ... </Hn>

where n=1, 2, 3, 4, 5, or 6.

Attributes:

The ALIGN attribute controls how the heading is aligned on the page. You can set a heading’s alignment to values of LEFT, RIGHT, CENTER, or JUSTIFY. The default alignment is LEFT.


FIGURE 3.11  Headings are rendered in boldface and are usually in a type size different from the body text.

Example:

<H1 ALIGN=”CENTER”>Table of Contents</H1>
<H2>Chapter 1 - Introduction</H2>
...
<H2>Chapter 2- Prior Research</H2>
...

<P>

Type:

Container

Function:

Denotes a paragraph. Most browsers ignore the use of multiple <P> tags to increase the amount of vertical space in a document.

Syntax:

<P ALIGN=”LEFT|RIGHT|CENTER|JUSTIFY”>
paragraph text
</P>

Attributes:

The ALIGN attribute controls how text in the paragraph is aligned. You can set ALIGN to LEFT (the default), RIGHT, CENTER, or JUSTIFY.

Example:

<P ALIGN=”CENTER”><H1>Welcome!</H1></P>


NOTE:  Although most browsers can parse standalone <P> tags without errors, the HTML 4.0 recommendation discourages the use of empty <P> tags.



Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.