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.

HTML 4.0 Sourcebook
(Publisher: John Wiley & Sons, Inc.)
Author(s): Ian S. Graham
ISBN: 0471257249
Publication Date: 04/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


STYLE Element: Style Sheet or Rendering Information

Usage: <STYLE> ... </STYLE>
Can Contain: characters
Can Be Inside: HEAD
Attributes: DIR, LANG,TITLE, MEDIA, TYPE

STYLE contains style sheet rendering instructions to be applied to the document when displayed by the browser. STYLE allows rendering information to be placed within the document and not as a second file referenced through a LINK element. The latter may be accomplished using LINK elements of the form:

<LINK REL=“stylesheet”
      HREF=“http:some.where.dom/path/stylesheet”
      TYPE=“mime/type”>

where mime/type is the MIME type of the indicated style sheet (text/css for cascading style sheets). The STYLE element allows for browsers that do not support linked style sheets. In this instance, STYLE is best thought of as an interim mechanism for including style sheet information, as it has several disadvantages compared with linked style sheets. In particular, a linked style sheet can be shared between many documents, while the STYLE element forces every document to contain the style sheet data.

However, STYLE has a second use—for local customization of an external style sheet. In this regard, you can use a linked style sheet to specify the broad details of the layout, with the content in the STYLE element providing small-scale, local modifications.

The following is a simple STYLE example; styling mechanisms are discussed in more detail in Chapter 7.

<HEAD>
<STYLE>
  BODY { background: url(waves.gif) black; }
  H1 {   margin-top: 10px;
        color:      #4F;
   text-align: left;
  font: 30px Arial, gill, helvetica, sans-serif; }
...
</STYLE>
....
</HEAD><BODY>

TITLE Element: Document Title

Usage: <TITLE> ... </TITLE>
Can Contain: characters
Can Be Inside: HEAD
Attributes: DIR, LANG

The title of a document is specified by the TITLE element. Every document must have a TITLE, and can only have one. The text inside a TITLE should indicate the document content in a concise but general way. A TITLE serves several purposes:

1.  To label the display window or text screen
2.  To serve as a record in a history or bookmark list marking documents you have viewed
3.  To allow quick indexing of a document in place of indexing the entire text

The TITLE is not part of the document text and cannot contain hypertext links or any other markup commands—it can contain only text, including entity or character references.

The TITLE should be short—preferably less than 60 characters—so that it can easily label a window or fit in a history list. You should be able to determine the content of the document from the TITLE itself. Otherwise, a person reviewing his/her bookmarks will see the title, but not know to what it refers. Here are some examples:

Good TITLEs:

<TITLE>Paper on Rings by Baggins and Gandalf, 1989</TITLE>
<TITLE>Introduction to MIME types </TITLE>

Bad TITLEs:

<TITLE>Introduction</TITLE>
<TITLE>A Summary of the Ring-Ring Interaction Cross-Section
Measurement of B. Baggins, et al. in both Low-Temperature and
High-Temperature Studies, including Water Immersion and
Non-Destructive Testing: A Brief Review plus Commentary on
the “Missing Ring” Problem.</TITLE>

Block and Heading Elements

Block elements divide a document into logical blocks of text, such as paragraphs (P), block quotations (BLOCKQUOTE), lists (see the following section), address information (ADDRESS), and so on. The block elements FORM, which defines a fill-in interactive form, and TABLE, which defines tabular structures, are more complex than the others and are described in detail later in this chapter.

Several proprietary block-like elements, such as FRAMESET, FRAME, and IFRAME (Netscape frame documents), MULTICOL (multicolumn text), and NOBR (no line breaks), are supported by a number of browsers. These are described in Chapter 7.

ADDRESS Element: Address Information

Usage: <ADDRESS> ... </ADDRESS>
Can Contain: P,
characters, character highlighting, A, APPLET, BASEFONT, BR, BUTTON, IFRAME, IMG, INPUT, LABEL, MAP, OBJECT, SCRIPT, SELECT, TEXTAREA
Can Be Inside: BLOCKQUOTE, BODY, CENTER, DD, DIV, DT, FIELDSET, FORM, LI, NOFRAMES, NOSCRIPT, TD, TH,
APPLET, BUTTON, IFRAME, OBJECT
Attributes: CLASS, DIR, ID, LANG, STYLE, TITLE, standard event handlers

ADDRESS denotes information such as addresses, electronic signatures, lists of authors, and so on. Typically, document authors would use ADDRESS to sign his or her documents. In this case, the ADDRESS is often placed at the bottom of the HTML document to keep it separate from the main text. In a family of documents, the ADDRESS may contain just the author’s initials or name connected by a hypertext link to a biographical page. Alternatively, a collection of documents may have an introductory document that has ADDRESS elements containing detailed contact information for the author or authors, with the remaining documents having ADDRESS elements containing hypertext links back to this page.

As with all semantic markup elements, the rendering of the contents of ADDRESS is left up to the browser. By default, most browsers render ADDRESS content in italics.

ADDRESS supports the standard “generic” and “event-handler” attributes described earlier in this chapter. Note that the event handlers are only partially supported by Internet Explorer 4 and are not supported by Netscape Navigator 4.

Figures 6.7 and 6.9 show some typical applications of the ADDRESS element. Browser rendering of these documents are shown in Figures 6.8 and 6.10, respectively.


Figure 6.7 HTML example document illustrating heading, BLOCKQUOTE, and ADDRESS elements. Figure 6.8 shows this document viewed by Internet Explorer 3.

<HTML>
<HEAD>
<TITLE> Examples of ADDRESS and BLOCKQUOTE elements</TITLE>
</HEAD>
<BODY>
<H1>The Meaning of Life </H1>

<P> How many times have you sat down and asked yourself “What is
the meaning of life?.“  I certainly have.  I’ve
even read many of the good books, from C.S. Lewis, to Kant, to
Sartre to Zoltan the Magnificent.  But I think the most profound
statement about life was made by Jack Handey, who said:
<BLOCKQUOTE>
<P>I can still recall old Mister Barnslow getting out every morning and
nailing a fresh load of tadpoles to that old board of his.  Then he’d
spin it around and around, like a wheel of fortune, and no matter where
it stopped he’d yell out, ”Tadpoles!  Tadpoles is a winner!”
We all thought he was crazy.  But then, we had some growing up to do.
</BLOCKQUOTE>
<P>That pretty well sums it up.
<HR>
<ADDRESS>  <A HREF=“about_the_author.html”> C.S.O </A> </ADDRESS>
</BODY>
</HTML>


Figure 6.8  Display, by the Internet Explorer 3 browser, of the document shown in Figure 6.7.


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.