About formatting and styles
Broadly speaking, there are two techniques that Web authors use to format content. Both techniques are familiar from popular word-processing programs.
Single-instance formatting
In the first technique, formatting is directly applied to a particular piece of content (such as a paragraph, a sentence, or a word). You select the content you want to format, and then you use commands in toolbars or menus to change, for example, its font, text size, margins, or borders. We can call this technique “single-instance” formatting, because the formatting is applied to a single instance of some content. Of course, you might apply the exact same formatting to more than one piece of content, but then you have to select and format each in turn, repeating your actions for each piece.
Styles
The second technique is far more powerful. In this technique, you define a style—a collection of appearance properties and values. Once defined, you can apply a style to any piece of content by simply selecting the style from a menu. Alternatively, you can define a style that is automatically applied to all instances of a particular type of element.
For example, if you are writing an online book, you might define a style for block quotes that appear at the beginning of each chapter. You could specify that these paragraphs be indented two centimeters on both sides, use an italic font, and have taller than normal line spacing. Having defined the style, you can apply it to a paragraph by selecting the style from the Style menu on the Formatting Toolbar. As another example, you could define a style for all bulleted lists, specifying that they use square bullets and bold text; then your style would be applied automatically to all bulleted lists.
Styles are contained in a style sheet. 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. Linking to an external style sheet is an extremely powerful technique, since you can alter the formatting of a whole set of documents that are linked to the same style sheet by just editing one file.
Single-instance formatting and styles both have their uses, and you can use both techniques in the same document—even on the same piece of content. With a few exceptions, any format can be applied using either technique. Use styles when you want to apply the same formatting to many or all instances of an element. Use a single-instance format when you need to override default formatting for one piece of content or to override an applied style for one instance of a content class.
The distinction between single-instance formatting and formatting using styles is only partially related to the distinction between HTML formatting and CSS formatting. Although styles use only CSS properties (not appearance-related HTML elements or attributes), single-instance formats may use HTML elements and attributes, CSS properties, or a combination of both. If a single-instance format uses CSS properties, those properties are applied using an inline declaration.
Related topics
Applying a single-instance format