JavaScript EditorBest javascript editor debugger     Ajax website 



Main Page

Previous Page
Next Page

Creating an External Style Sheet

External style sheets are ideal for giving all the pages on your Web site a common look. You can define all your styles in an external style sheet and then tell each page on your site to consult the external sheet, thus ensuring that each will have the same settings.

To create an external style sheet:

1.
Create a new text document in your text editor of choice.

2.
Define the style rules for your Web pages as described in Chapters 914 (Figure 8.1).

Figure 8.1. Use any text editor you like to write CSS documents. This is WordPad.


3.
Save the document in a text-only format in the desired directory (Figure 8.2). Give the document the extension .css to designate the document as a Cascading Style Sheet.

Figure 8.2. Be sure to save the CSS file with the .css extension and in text-only format (as a Text Document, or Plain Text, or ASCII, or however your text editor calls it).


Tips

  • Make sure you save the style sheet in a text-only format (sometimes called Text Document or Plain Text) and give it the .css extension. When you upload it to the server (which we'll get to in Chapter 23), be sure to choose ASCII modenot Binaryjust as you do for (X)HTML files. This goes for Mac folks, too!

  • External style sheets must be either linked to (see page 129) or imported (see page 132).

  • If your style sheet will contain non-ASCII characters, you should declare its character encoding on the first line with @charset "encoding"; (see page 332).

  • XSL (Extensible Stylesheet Language) is another style sheet language for XHTML pages. You can find more information about it at the W3C's XSL site, http://www.w3.org/Style/XSL/



Previous Page
Next Page


JavaScript EditorBest javascript editor debugger     Ajax website