Buy online at www.borders.com

It's Not Just Help. . .

So How Does It Work?

HTML Topics & Templates
CSS
DHTML

Project File (.hhp)

Contents File (.hhc)

Merging Modular Files

Accelerating Links

Distribution & Installation



HTML Help Resources on the Web



Style Rule Basics

Each style defined in a style sheet requires a style sheet rule consisting of the following parts:

  • A selector identifying the element which the rule affects; usually this is a standard HTML element such as <P> or <LI>
  • One or more declarations describing the formatting for the specified selector. In turn, each declaration consists of:
    • a property, one of approximately 50 CSS-supported aspects of formatting, such as font-family, margin-top, or border-style; and
    • a value, a precise specification for the property, such as the name of the font-family or the size of the margin-top.

These elements apply to a typical style sheet rule like this:

This rule would be written in the style sheet as:

H2 {color: yellow; font-weight: bold;}

and would format all second-level headings <H2> to use type in the color yellow and with a font-weight of bold. For detailed information on selectors, properties, and rules in CSS, consult chapter 4 of Building Enhanced HTML Help with DHTML & CSS.

Spaces & punctuation

As with most basic HTML code, the Web browser ignores most spaces and line breaks; adding spaces makes the code human-readable. One place where spaces do matter: do not put a space between a value and a unit of measurement (for example, 1in not 1 in).

The punctuation, however, is critical in allowing the browser to read the code. Each style sheet rule requires the following punctuation:

  • curly braces surrounding the declaration (or list of declarations) and separating it from the selector and from any other style sheet rules;
  • semicolons separating the declarations in a list (a semicolon following the last declaration is recommended but not required);
  • colons within each declaration, separating the property from its value.