HTML The Definitive Guide (97 page)

Read HTML The Definitive Guide Online

Authors: Chuck Musciano Bill Kennedy

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

This property is not supported by Internet Explorer; Netscape supports only the pre and normal values.

9.2 Style Syntax

9.4 Tag-less Styles: The

Tag

Chapter 9

Cascading Style Sheets

 

9.4 Tag-less Styles: The Tag
Up to now, we have used Cascading Style Sheets to change the appearance of content that is within a designated HTML tag. In some cases, however, you may want to alter the appearance of only a portion of a tag's contents - usually text. Designate these special segments with the tag.


Function:

Delimit arbitrary amount of text

Attributes:

CLASS ONKEYUP

DIR ONMOUSEDOWN

ID ONMOUSEMOVE

LANG ONMOUSEOUT

ONCLICK ONMOUSEOVER

ONDBLCLICK ONMOUSEUP

ONKEYDOWN STYLE

ONKEYPRESS TITLE

End tag:

; never omitted

Contains:

html_content

Used in:

body_content

The tag simply delimits a portion of HTML content (constrained by normal tag nesting rules, of course). Browsers treat the tag as another physical or content-based style tag. The only difference, of course, is that the default meaning of the tag is to leave the text alone.

Although it may serve some other function in a future version of HTML, the tag was introduced so that you can apply style, display, and event management to an arbitrary section of document content. Display and event management are addressed later; to define a style for the tag, treat it like any other HTML tag: SPAN {color: purple}

SPAN.bigger {fontsize: larger}

and use it like any other style tag:

Quat harvest projections are bigger than ever!

In a similar manner, the appearance of a tag can be changed using an inline style:

Quat harvest projections are bigger than ever!

Like any other physical or content-based style tag, tags can be nested and may contain other tags.

The tag also supports the standard HTML 4.0 tag attributes. The style and class attributes, of course, let you control the display style; the id and title tag attributes let you uniquely label its contents; the dir and lang attributes let you specify its native language; and the many on-event attributes let you react to user-initiated mouse and keyboard actions on the contents. Not all are implemented by the currently popular browsers for this tag or for many others.
[The dir attribute,

3.5.1.1] [The lang attribute, 3.5.1.2]
[The id attribute, 4.1.1.4]
[The title attribute, 4.1.1.5]
[Inline Styles: The style Attribute,

9.1.1]
[Style Classes, 9.2.4]
[JavaScript Event Handlers, 13.3.3]

9.3 Style Properties

9.5 Applying Styles to

Documents

Other books

Gypsy Bond by Lindy Corbin
Ardor by Roberto Calasso
Inevitable by Louis Couperus
The Templar Prophecy by Mario Reading