3 4
Cascading style sheets (CSS) are used to format Web pages in much the same way traditional style sheets are used to format standard Word documents. The role of a cascading style sheet is to present a Web page's formatting information in a specific place—either at the beginning of an HTML document or in a separate document—in a format that browsers can easily interpret and apply to the associated Web page or Web pages. Using cascading style sheets provides a convenient way to format several Web pages or a whole Web site. When cascading style sheets are in use, you can change the format of Web pages by making changes to the style sheet information instead of editing individual Web pages.
Because Word automatically creates your source code, you don't actually see when Word creates cascading style sheets. By default, Word uses cascading style sheets if your target browser option is set to Internet Explorer 4 or Netscape Navigator 4. (For more information about configuring your target browser, see the section "Specifying Target Browser Options".) When Word creates a cascading style sheet, Word embeds the style sheet at the top of each Web page.
In addition to generating cascading style sheet information, you can use Word to attach, remove, and manage cascading style sheets for Web pages. You can also use Word to attach more than one style sheet to a Web page if necessary. For example, you might have one style sheet that's part of a large Web site, such as a style sheet for an international corporation, and another style sheet that defines a smaller group of related pages, such as a style sheet for a regional office. You can then specify which style sheet takes precedence over the other, in case conflicting styles are defined for the same elements. When you attach a style sheet to your Web page in Word, the styles contained in the cascading style sheet will appear in the Styles And Formatting task pane.
For more information about the Styles And Formatting task pane, see Chapter 10, "Using Styles to Increase Your Formatting Power."
If you have a cascading style sheet file, you can attach it to a Web page. Cascading style sheets carry the .css extension. You attach a cascading style sheet to a document in the same way you attach a global template or an add-in. Specifically, you must complete the following steps:
Figure 31-23. You can use the Linked CSS Style Sheets dialog box to attach, detach, and prioritize cascading style sheets.
After you attach a cascading style sheet to a document, the styles from the cascading style sheet will appear in the Styles And Formatting task pane.
The order of cascading style sheets provides a precedence that determines which styles are applied if two or more style sheets have conflicting settings for the same element. When you move a style sheet up in the list, you assign a higher priority to the style sheet. Likewise, when you move a style sheet down in the list, you assign a lower priority to the style sheet. To configure precedence among style sheets, follow these steps:
You can detach a cascading style sheet if you want to stop using the cascading style sheet to format a document. To do so, follow these steps:
Keep in mind that when you remove a style sheet from the list, you don't delete the style sheet's file; you simply instruct the current document to stop referring to the style sheet.