HTML The Definitive Guide (42 page)

Read HTML The Definitive Guide Online

Authors: Chuck Musciano Bill Kennedy

BOOK: HTML The Definitive Guide
3.77Mb size Format: txt, pdf, ePub

Introduced in the HTML 4.0 standard, the tag is virtually identical to its

counterpart. The difference is in their display and application. Use for short quotes that may be in line with surrounding plain text. Although not yet supported by the popular browsers, the HTML 4.0

standard dictates that the -enclosed text begin and end with double-quote marks. Use the

tag, on the other hand, for longer segments that the browser will set off - usually as an indented block - from the surrounding content, such as that shown in
Figure 4.24.


Function:

Define a short quotation

Attributes:

CITE ONKEYUP

CLASS ONMOUSEDOWN

DIR ONMOUSEMOVE

ID ONMOUSEOUT

LANG ONMOUSEOVER

ONCLICK ONMOUSEUP

ONDBLCLICK STYLE

ONKEYDOWN TITLE

ONKEYPRESS

End tag:

; never omitted

Contains:

body_content

Used in:

text

4.8.2.1 The cite attribute

The cite attribute works with the tag just like it does for the

tag: it lets you indicate the source of a quote. The attribute's value should be a quote-enclosed URL that points to the online document and, if possible, the exact location in the document where the quote came from.

4.8.2.2 The dir and lang attributes

The dir attribute lets you advise the browser as to which direction the text within the segment ought to be displayed, and lang lets you specify the language used within that tag.
[The dir attribute,

3.5.1.1] [The lang attribute, 3.5.1.2]

4.8.2.3 The class, id, style, and title attributes
Use the style attribute to specify an inline style for the tag, or use the class attribute to apply
a predefined style class to the tag. [Inline Styles: The style Attribute, 9.1.1]
[Style Classes, 9.2.4]

You may assign a unique id to the tag, as well as a title, using the respective attribute and
accompanying quote-enclosed string value. [The id attribute, 4.1.1.4]
[The title attribute, 4.1.1.5]

4.8.2.4 Event attributes

Like with most other tagged segments of content, user-related events can happen in and around the tag, such as when a user clicks or double-clicks within its display space. Many of these events are recognized by the browser if it conforms to the HTML 4.0 specification (none do fully). With the respective "on" attribute and value, you may react to that event by displaying a user dialog box or activating some multimedia event.
Section 13.3.3
in Chapter 13

4.7 Precise Spacing and

4.9 Addresses

Layout

Chapter 4

Text Basics

 

4.9 Addresses

Addresses are a very common element in text documents, and HTML provides a special tag that sets addresses apart from the rest of a document's text. While this may seem a bit extravagant - addresses have few formatting peculiarities that would require a special tag - it is an example of content, not format, which is the intent and purpose of HTML markup.

By defining text that constitutes an address, the author lets the browser format that text in a different manner, as well as process that text in ways helpful to users. It also makes the content readily accessible to automated readers and extractors. For instance, an online directory might include addresses the browser collects into a separate document or table, or automated tools might extract addresses from a collection of documents to build a separate database of addresses.

4.9.1 The

Tag

The

and its required end (
) tag tell a browser that the enclosed text is an address. The browser may format the text in a different manner than the rest of the document text, or use the address in some special way. You also have control over the display properties through the style and class attributes for the tag (see
Chapter 9).


Function:

Define an address

Attributes:

CLASS ONKEYUP

DIR ONMOUSEDOWN

ID ONMOUSEMOVE

LANG ONMOUSEOUT

ONCLICK ONMOUSEOVER

ONDBLCLICK ONMOUSEUP

ONKEYDOWN STYLE

ONKEYPRESS TITLE

End tag:

; never omitted

Contains:

body_content

Used in:

address_content

The text within the

tag may contain any element normally found in the body of an HTML document, excluding another
tag. Style changes are allowed, but may conflict with the style chosen by the browser to render the address element.

We think most, if not all, HTML documents should have their authors' addresses included somewhere convenient to the user, usually at the end. At the very least, the address should be the author's or webmaster's email address, along with a link to their home page. Street addresses and phone numbers are optional; personal ones are usually not included for reasons of privacy.

For example, the address for the webmaster responsible for a collection of commercial web documents often appears in source documents as follows, including the special mailto: URL

protocol that lets users activate the browser's email tool:


Webmaster
O'Reilly & Associates, Inc.
Cambridge, Massachusetts


Figure 4-25 displays the results.

Figure 4.25: The

tag in action
Whether it is short and sweet or long and complete, make sure every document you create has an address attached to it. If something is worth creating and putting on the Web, it is worth comment and query by your readership. Anonymous documents carry little credibility on the Web.

4.9.1.1 The dir and lang attributes

The dir attribute lets you advise the browser as to which direction the text within the


Other books

Dolls Are Deadly by Brett Halliday
Lament for a Maker by Michael Innes
Casino Moon by Peter Blauner
L'Affaire by Diane Johnson
Girl in Profile by Zillah Bethell
Caught Up in the Touch by Laura Trentham
The Family by Kitty Kelley
Cuando cae la noche by Cunningham, Michael
A Girl's Best Friend by Jordan, Crystal