Using style sheets

A style sheet is a collection of styles (also called “style rules”, or just “rules”). Style sheets can be internal or external. An internal style sheet is one that is part of a document—the style sheet exists in the <head> section of the document’s HTML source, and it can only be used by that document. An external style sheet, on the other hand, exists as a separate text file. Any document can link to an external style sheet, making the styles defined in it available to the document.

To create an internal style sheet for the current document, you define one or more styles. You can then apply the styles you have defined in the Styles dialog box (or they may be applied automatically to all elements of specified types). You can also save the style sheet as an external file for use with other documents.

In this section

Defining a style

Applying a class style

Assigning an ID to an element

Linking to an external style sheet

Saving an internal style sheet as an external style sheet

Editing an external style sheet with a text editor

Working with multiple style sheets

Using style sheets