HyperText Markup Language
 [Previous]

Text Formatting Tags (HTML): Usage


<P>...</P> - Paragraph Break

The paragraph break tag is generally used alone, however it also has a closing tag ( </P> ) which may be used. Unless the paragraph tag is used, text will continue to wrap without any break. The paragraph tag renders a line break followed by a blank line of white space.

This coding:

<P>This is paragraph one.</P><P>This is paragraph two.</P>

or

This is paragraph one.<P>This is paragraph two.

Renders:

This is paragraph one.

This is paragraph two.

Note - The ALIGN=CENTER | LEFT | RIGHT attribute may now be used with the <P> tag when applying alignment to a single paragraph. However, if applying alignment to a larger portion of text, or text and other entities, favor the <DIV> tag (e.g., <DIV ALIGN=CENTER> ... </DIV>) to center blocks of text.

Also Note - The ALIGN= attribute has been deprecated for most tags in HTML 4.01 - strict in favor of style sheets.


<BR> - Line Break

The line break tag is used alone. Unless the line break tag is used, text will continue to wrap without any break. The line break tag renders a break in the wrapping text; however, there is no white space.

This coding:

This is line one.<BR> This is line two.

Renders:

This is line one.
This is line two.

Note - The CLEAR=LEFT | ALL | RIGHT attribute may now be used with the <BR> tag to force the wrapping of text to break and clear an image.

Also Note - The CLEAR= attribute has been deprecated for the <BR> tag in HTML 4.01 - strict in favor of style sheets.


<HR> - Horizontal Rule

The Horizontal Rule tag creates a line across the screen. The line resizes according to each browser's screen width as any given time. It includes a line break, but not always white space on either side of the line. To ensure white space, use a paragraph break on either side of the horizontal rule code.

This Coding:

This is line one without white space.<HR> This is line two without white space.

Renders:

This is line one without white space.


This is line two without white space.

This Coding:

This is line one with white space.<P><HR><P> This is line two with white space.

Renders:

This is line one with white space.


This is line two with white space.

Note - In HTML 3.2, the following attributes were introduced for the the <HR> tag; they are all deprecated in "strict" HTML 4.01:

This Coding:

This is line one with white space.<P><HR SIZE=5 WIDTH="80%" NOSHADE><P> This is line two with white space.

Renders:

This is line one with white space.


This is line two with white space.


<HX>...</HX> - Headings

The Web browser supplies the appropriate sized and styled font for each heading level (1-6). Since the "heading" code may imply "style" as well as "size," do not include strong, emphasis, bold, or italics within a heading code. You may include ALIGN=center with your header to center it on the page; however, it is better to use style sheets for changing the appearance of existing HTML tags like the headers (note the appearance change in headers one, two, and three below, achieved with style sheets).

Example:

This is Header One

This is Header Two

This is Header Three

This is Header Four

This is Header Five
This is Header Six

When centering, this coding:

<H3 ALIGN=center>This is Header Three Centered</H3>

Renders:

This is Header Three Centered


<BLOCKQUOTE>...</BLOCKQUOTE> - Quoted Text

Use the <BLOCKQUOTE> tag to set a block of text off as "quoted." Most browsers will render blockquote as indented from the left and right margins, and sometimes in italics as well.

This coding:

<BLOCKQUOTE>
Attributed to <A HREF="http://www.loc.gov/coll/print/guide/pp2439.jpg"> Nicholas H. Shepherd. <CITE>Abraham Lincoln</CITE></A>. Quarter-plate daguerreotype, circa 1846. <EM>(Gift of Mary Lincoln Isham)</EM>
</BLOCKQUOTE>

Renders:

Attributed to Nicholas H. Shepherd. Abraham Lincoln. Quarter-plate daguerreotype, circa 1846. (Gift of Mary Lincoln Isham)


<PRE>...</PRE> - Preformatted Text

Use the preformat tag when you wish to preserve the exact layout of your text. For example, when you have text in tabular columns or aligned in a way that there is no HTML equivalent for.

This coding:

<PRE>

       PACKAGING AND MAILING FEES
                                        FOREIGN
                           U.S.    Surface   Air Mail
       $20.00 or less     $3.50     $4.50     $10.00
        20.01 -  50.00     8.50      9.50      18.00
        50.01 - 150.00    13.50     14.50      30.00
        Over   $150.01    8% of     10% of    15% of
                          value      value     value
</PRE>

Renders:

       PACKAGING AND MAILING FEES
                                        FOREIGN
                           U.S.    Surface   Air Mail
       $20.00 or less     $3.50     $4.50     $10.00
        20.01 -  50.00     8.50      9.50      18.00
        50.01 - 150.00    13.50     14.50      30.00
        Over   $150.01    8% of     10% of    15% of
                          value      value     value


<DIV> ... </DIV> - Logical Division

The DIV tag is used to mark up logical divisions in a document. It can enclose paragraphs, headers and other block elements including images. It is used heavily in HTML 4.01 to apply style sheet settings to blocks of text.

<DIV STYLE="background: #ffffcc; font-family: Arial, Helvetica, sans-serif;">
<A HREF="http://www.loc.gov/poetry/">Poetry in America: A Library of Congress Bicentennial Celebration</A> <BR> Poet Laureate Robert Pinsky and other renowned poets and individuals will read their favorite poems and participate in a symposium, <CITE>"Poetry and the American People,"</CITE> at the Library on April 3 and 4. The event will be cybercast live.</DIV>

Renders:

Poetry in America: A Library of Congress Bicentennial Celebration
Poet Laureate Robert Pinsky and other renowned poets and individuals will read their favorite poems and participate in a symposium, "Poetry and the American People," at the Library on April 3 and 4. The event will be cybercast live.


Go to:


Library of Congress
Library of Congress Help Desk (October 17, 2000)