Importing External Style Sheets
You can also call on an external style sheet by importing it.
To import an external style sheet:
Within the style element (see page 131), but before any individual style rules, type @import "external.css";, where external.css is the name of your CSS style sheet (see step 3 on page 128) (Figure 8.15).
Tips
The @import rule can also be written as @import url(external.css); or @import url("external.css");. Regardless, always put it before any other style rules in the style element and don't forget the semicolon. Style rules in an imported style sheet take precedence over any rules that come before the @import rule (for example, rules in earlier @import rules or in external sheets placed before the style element). You may use the @import rule in an external style sheet (as always, before any other style rules). The @import rule has been used as a way to hide CSS rules from buggy browsers, in particular Netscape 4 (Figure 8.14). For example, you could link to style sheets with rules that Netscape 4 understood and then import style sheets with advanced techniques it couldn't handle.
Since linking style sheets (see pages 129130) gives you the ability to indicate preferred and alternative style sheets (and Netscape 4 is no longer an issue), that's the method I prefer. You can limit imported style sheets to particular outputs, as described on the following page.
|