CSS Optimization

CSS optimization is the process of minimizing your markup and CSS files for maximum speed. You can employ some of the same techniques to optimize CSS that you learned in Chapter 3, "HTML Optimization." Whitespace removal, cutting comments, crunching color values, and embedding code with SSI are some of the techniques common to both CSS and HTML optimization. CSS gives you more flexibility than HTML or XHTML, however, because you can make up your own names and group rules together to save space.

You'll reap the greatest rewards by using CSS to transform your code into a more rule-based modus operandi. Converting old-style table/font layouts into XHTML/CSS-style code typically saves 25 to 50 percent off file sizes and gives you the benefits of adaptable structure and separate presentation. You can use layering and inheritance to save space and increase compatibility, and use shorthand properties to shrink your CSS code by up to 50 percent. This chapter gives you the tools you need to optimize your CSS.

NOTE: See Jeffrey Veen's The Art & Science of Web Design (New Riders, 2001) for more rule-based design ideas.

In Chapter 8, "Advanced CSS Optimization," you'll put these techniques to work with real-world examples showing substitution and optimization in action.

This chapter assumes you have some familiarity with CSS. To learn CSS, I recommend Cascading Style Sheets: The Definitive Guide by Eric A. Meyer (O'Reilly, 2000), Eric Meyer on CSS (New Riders, 2002), and Designing CSS Web Pages by Christopher Schmitt (New Riders, 2002).

 



Speed Up Your Site[c] Web Site Optimization
Speed Up Your Site[c] Web Site Optimization
ISBN: 596515081
EAN: N/A
Year: 2005
Pages: 135

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net