At the simplest level, a style is nothing more than a rule the
browser follows to render a particular HTML or XHTML tag’s
contents.[*] Each tag has a number of style properties associated with
it, whose values define how that tag is rendered by the browser. A rule
defines a specific value for one or more properties of a tag. For
example, most tags can have a
property, the value of which defines the color in which the modern GUI
browser should display the contents of the tag. Other properties include
fonts, line spacing, margins, borders, sound volume, and voice, which we
describe in detail later in this chapter.
There are three ways to attach a style to a tag: inline, on the document level, or through the use of an external stylesheet. You may use one or more stylesheets for your documents. The browser either merges the style definitions from each style or redefines the style characteristic for a tag’s contents. Styles from these various sources are applied to your document, combining and defining style properties that cascade from external stylesheets through local document styles, and ending with inline styles. This cascade of properties and style rules gives rise to the standard’s name: Cascading Style Sheets.
We cover the syntactic basics of the three stylesheet techniques here. We delve more deeply into the appropriate use of inline, document-level, and external stylesheets at the end of this chapter.
The inline style ...