Style Sheet Organization

Although Hours 6 and 20 stressed naming and organizing your style sheets, there are two additional and important factors to keep in mind. By consolidating both style classes and style applications, you can reduce the size of your code.

The first of these matters, consolidating style classes, involves reducing the size of your style sheet and class attribute values. For example, if you are using only one font style for your entire document (that is, every instance of text should be 16-point Helvetica, aligned center, with 20-point letter spacing), you should consolidate all font classes into one style, eliminating duplicate information.

Listings 22.3 and 22.4 show the difference between a consolidated class definition ...

Get Sams Teach Yourself SVG in 24 Hours 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.