Introduction to Style Sheets · 17 August 2001

Though the standards were established years ago, there’s been a lot of noise lately about CSS (Cascading Style Sheets), the powerful method for globally formatting text and objects in fourth-generation web browsers. Authoring tools and text editors now offer strong support for CSS, although the panoply of browsers and platforms and default settings on tens of millions of computers vary in ability when it comes to correctly interpreting CSS formatting, the source of much consternation.

Word processors, as well as print-based page layout programs such as those from Quark and Adobe, have supported style sheets for years, yet a surprising number of designers, typesetters and desktop publishers haven’t bothered to learn the benefits of consistency and quick revision that style sheets offer.

I’ll address CSS and the web in another article; what follows is a brief introduction, with a few tips, to style sheets as a general idea whose contribution to the health and vitality of millions equals that of oxygen. Well…

The term comes from another time, when a designer’s skill meant an ability to read and instruct specialists far more than manipulate mouse and keyboard. A book designer, for example, would evaluate a manuscript on its length, its tone, its structure, its production budget, then draw up a style sheet to be handed off to a typesetter. The sheet indicated requirements for typefaces, font sizes, leading, word spacing, line length, size of the text block, and so on.

If style sheets were traditionally defined as a contained set of formatting instructions, in digital publishing terminology they are a contained set of formatting instructions invisibly attached to a defined quantity of text, which can range from a single character to an entire document.

Without style sheets, formatting and revising is daunting work. Text is selected, attributes are applied from a variety of menus and dialog boxes: font, size, colour, indentation, leading, whatever. If revisions are required down the line, let’s say all subheads need to go from small caps to italic, each subhead will have to be hunted down, its formatting manually changed.

With style sheets, formatting for subheads can be stored in one place. Once a style sheet is altered, every instance of text to which it has been attached is reformatted instantly: change the Subhead style sheet, phwup, all subheads are now italic.

In a text editor such as Word, and in page layout programs such as InDesign and Quark (version 4+), there are two kinds of style sheet: paragraph-based and character-based. Paragraph-based style sheets are a sort of invisible wrapper attached to text residing between two carriage returns, i.e., the first paragraph of a section, a block quotation, or a chapter title. Character-based style sheets are applied to a range of text within paragraphs, i.e., a word or phrase in italics or small caps, a string of numerals, anything requiring local formatting within two carriage returns.

Creating Style Sheets

Once again acknowledging the monopolistic ubiquity of Word as a text editor, I’ll refer to its commands, which in truth aren’t that different from other applications where style sheets come into use. Note that it is highly recommended to do as much blanket formatting with style sheets in a word processor than in a page layout program, wherein searching and replacing options are far fewer.

Word has a variety of style sheets already built in, ready to go. When using Word in Outline Mode, the markers of a paragraph’s position in the outline hierarchy (Heading 1, Heading 2, etc.), are style sheets. These correspond to the <h1>, <h2>, etc., hierarchy of heading tags used in HTML. Generally, however, it makes more sense to name your own style sheets.

The simplest way of creating a paragraph-based style sheet is to select some text (it doesn’t matter how close the formatting is to its intended form, you can easily change the style sheet you’re going to create later), then, in the Style input box on the formatting toolbar (at first all text is “Normal”), type a new name. Call it Bob. Whatever.

Through the Format -> Style menu option, you can now do all sorts of things to this new sheet called Bob or Whatever. Change formatting, paragraph characteristics, assign a keyboard shortcut to quickly apply the style sheet, you name it. Now this style sheet can be applied to any paragraph of text in your document, and, once applied, will govern the paragraph’s formatting.

Creating a character-based style sheet is nearly as simple. Select some text, go to the Format -> Style menu option, Create and name a new style sheet, indicate through the pull-down menu it is to be character-based, adjust characteristics, assign a keyboard shortcut if you like, you’re off.

Applying Style Sheets

Although it sometimes will try, a text editor such as Word can’t divine which style sheets need to be applied where, but there are tricks that can speed up their assignment. So long as there is a consistent attribute to a style of paragraph, Word’s Search and Replace can do much of applying for you. If every chapter title in a document, for example, includes the word “chapter” followed by a numeral, then search for each instance (type Chapter ^# in the find box), and define the attributes in the replace box to include the Chapter style sheet.

If every paragraph requiring an indented first line, such as those subsequent to the first paragraph in a section, have already been indented with a tab (not the safest practice – better to indent the first line using paragraph formatting in a style sheet), then it’s simple enough to use Search and Replace to remove each tab in the document (type ^t in the search box), while applying an Indented Paragraph style sheet at the same time.

After All That

Comes the truly beautiful part. Once style sheets have been assigned, and everything knows its place, the document can be imported into a page layout program, with all applied style sheets intact. Once in a program like Quark or InDesign, extremely precise adjustments can be made to style sheets, including hyphenation and justification preferences, letterspacing, widow and orphan control, default page positioning, much, much more.

And the Web?

Word does have a built-in ability to export directly to HTML, and does some pretty ambitious conversions of its own style sheets to CSS, but it simply cannot be trusted to render properly in even Microsoft’s own browsers. In a forthcoming article I’ll discuss using macros to convert Word style sheets into CSS element formatting.

*   *   *