Moving and Managing Styles

In the old days, when CSS support in web browsers was new, site designers would create just a handful of styles to format headlines and text. Keeping track of a site’s styles back then wasn’t too hard. Today, with great CSS support in browsers and CSS-based layout the norm, it’s not uncommon to create a style sheet with hundreds of styles.

You might want to take a really long, complicated style sheet and split it up into several smaller, easier-to-read external style sheets. One common design practice is to store styles that serve related functions in separate style sheets—for example, all the styles related to formatting web forms would be in one style sheet, styles for text in another, and styles for page layout in yet another. You can then link each of the external style sheets to your site’s pages as described on Linking to an External Style Sheet.

Or you might find yourself in the opposite situation: You have too many style sheets and want to combine the styles into a single sheet to cut down on the number of files a web browser needs to download from your web server.

Note

For really busy websites, the conventional wisdom is to use only a single external style sheet. That’s because each request for a new file takes time and server power, so the more requests a browser makes for files, the slower the server performs. But unless your site is as busy as Yahoo, Google, or Amazon, your visitors won’t notice if you use one or five external style sheets.

Even ...

Get Dreamweaver CS6: The Missing Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.