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


<PRE>

Type:

Container

Function:

Denotes text to be treated as preformatted. Browsers render preformatted text in a fixed-width font. Whitespace characters, such as spaces, tabs, and carriage returns, found between the <PRE> and </PRE> tags are not ignored. This makes preformatted text a viable option for presenting tables of information.

Syntax:

<PRE WIDTH=”width_of_widest_line”>
... preformatted text goes here ...
</PRE>

Attributes:

The <PRE> tag’s WIDTH attribute is set to the number of characters in the widest line of the preformatted text block. This information helps some browsers choose the font size for displaying the text. Use of the WIDTH attribute has been deprecated in HTML 4.0.

Example:

<PRE WIDTH=34>
Catalog No.  Item           Price
AZ-1390      Polo Shirt     $29.99
FT-0081      Sweater        $52.99
CL-9334      Belt           $16.99
</PRE>

<SPAN>

Type:

Container

Function:

Generic container tag for defining a document block. One popular use is for applying style information.

Syntax:

<SPAN STYLE=”style information” ALIGN=”LEFT|RIGHT|CENTER|JUSTIFY”>
range of text over which style is to be applied
</SPAN>

Attributes:

If you’re assigning style information, you can set the STYLE attribute to a sequence of as many characteristic: value pairs as you need to specify the style information you’re applying. Valid style characteristics are those put forward in the Cascading Style Sheets Level 2 specification.

The ALIGN attribute can take on the customary values of LEFT, RIGHT, CENTER, and JUSTIFY.

Example:

<SPAN STYLE=”font-weight: bold; color: red; text-indent: 0.25 in”>
Here is some bold, red, text that’s indented by one quarter of an inch.
</SPAN>

List Tags

Technically, HTML lists are a form of block-level formatting, but because lists are such a useful way of presenting content, the list tags merit their own section in the chapter.

HTML 4.0 continues to support five types of lists, although tags for two of the five have been deprecated. Using the tags in this section, you can create the following types of lists:

  Definition lists
  Directory lists (deprecated)
  Menu lists (deprecated)
  Ordered (numbered) lists
  Unordered (bulleted) lists

Most HTML lists make use of the list item tag, <LI>, so this tag is covered first, followed by the tags you use to create each type of list.

<LI>

Type:

Container

Function:

Denotes an item in a list.

Syntax:

<LI TYPE=”list_type” START=”start_value”> ... list item goes here ... </LI>

Attributes:

The <LI> tag can take four attributes:

  COMPACT—Instructs the browser to render the list item in as small a space as possible.
  START—(Ordered lists only) You can change the starting value of the numbering sequence from the default of 1 to any other value you choose.
  TYPE—(Ordered and unordered lists) You can modify the numbering scheme in an ordered list or the bullet character in an unordered list by setting TYPE to one of the list types available. Ordered list types include 1 (Arabic numerals), A (uppercase alphabet), a (lowercase alphabet), I (uppercase Roman numerals), and i (lowercase Roman numerals). The unordered list types include DISC (solid circular bullet), SQUARE (solid square bullet), and CIRCLE (open circular bullet).
  VALUE—Sets the numbering value of the list item.

All the attributes listed above have been deprecated.


Even if you are not using an Arabic numeral numbering scheme, you should still set START equal to a numeric value. Browsers know to map the START value to any numbering scheme you’ve specified in a TYPE attribute. For example, the code:

<LI TYPE=”a” START=”4">

will produce an ordered list beginning with the lowercase letter d.


Example:

<LI>Cookie Dough</LI>
<LI>Rocky Road</LI>
<LI>Mint Chocolate Chip</LI>

Related Tags:

The <LI> tag is always used in conjunction with one of the other HTML list tags: <DIR>, <MENU>, <OL>, and <UL>.


NOTE:  Even though the <LI> tag is technically a container tag, most people use it as a standalone tag, and most browsers are able to interpret standalone <LI> tags correctly.

<DIR>

Type:

Container

Function:

Creates a directory listing. Items in a directory list are bulleted and generally short—usually not more than 20 characters in length. Originally, directory lists were intended for rendering narrow columns of information, such as indexes or telephone directory listings.

The <DIR> tag has been deprecated by the W3C. You should use an unordered list (<UL>) instead.

Syntax:

<DIR COMPACT>
<LI>List item 1</LI>
<LI>List item 2</LI>
...
</DIR>

Attributes:

The optional COMPACT attribute instructs a browser to reduce the spacing between list items so that the list is rendered in the smallest amount of vertical space possible.

Example:

<DIR>
<LI>Mary Garrison, x521</LI>
<LI>Tom Hinkle, x629</LI>
<LI>Pat Joseph, x772</LI>
</DIR>

Related Tags:

List items in a directory list are specified with the <LI> tag.

<DL>

Type:

Container

Function:

Denotes a definition list (see Figure 3.12).

Syntax:

<DL COMPACT>
 ... terms and definitions go here ...
</DL>

Attributes:

The COMPACT attribute is optional and enables you to compress the list into the smallest vertical space possible on the browser screen.

Example:

<DL>
<DT>Browser</DT>
<DD>A program that allow a user to view World Wide Web pages</DD>
<DT>Server</DT>
<DD>A program that fields requests for web pages</DD>
</DL>


FIGURE 3.12  Definition lists have a term/definition structure similar to a glossary at the back of a book.

Related Tags:

Terms in a definition list are specified with the <DT> tag, and their definitions are specified with the <DD> tag.


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.