Chapter 10. Cascading Style Sheets

Cascading Style Sheets (CSS) are one of the greatest features to come out of the World Wide Web Consortium (W3C). CSS simplifies repetitive formatting tasks, such as indenting the first line of every paragraph, by defining styles to be applied within a page. Attaching the same CSS stylesheet to multiple pages (or to the template on which multiple pages are based) makes it easy to redefine styles globally throughout your site. CSS can be used to set page attributes (such as margins and background images), provide rollover states for hyperlinks, align images, and format tables.

An exhaustive discussion of CSS is beyond the scope of this book, but this chapter will give you a good overview and cover its use in Dreamweaver. For full details on CSS, see Cascading Style Sheets: The Definitive Guide by Eric A. Meyer (O’Reilly). For quick-reference information including browser, CSS1, and CSS2 support, choose O’Reilly CSS Reference from the Book pop-up menu in the Reference panel (Window Reference).

CSS Overview

Conceptually, CSS is pretty simple—you define styles that can be applied easily over one or more pages. But the details can get confusing unless you’re familiar with the terminology (especially because Dreamweaver’s terminology varies slightly from that used elsewhere). We’ll start with the big picture and work our way towards the details.

CSS Versus HTML Styles

First let’s compare CSS to so-called HTML styles (discussed in Chapter 11).

CSS stylesheets: ...

Get Dreamweaver in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.