[ Team LiB ] |
Apply Styles WiselyBefore you can optimize CSS, you need to understand the four ways to apply styles to (X)HTML documents :
These methods are listed from the most abstract to the most specific. Let's use a minimal XHTML document to demonstrate them all (see Listing 7.1). Listing 7.1 Four Ways to Apply Styles
In honor of Mondrian and efficiency, I recommend being as abstract as possible when applying styles. Try to use external style sheets wherever possible, and avoid embedding style elements and attributes within your (X)HTML. External style sheets are reliably cached, and reduce overall bandwidth usage. For maximum speed on high-traffic pages, however, you can embed rules in a style element or SSI them into the page to avoid an extra HTTP request. For more details on using style sheets and XHTML, see Chapter 5, "Extreme XHTML." |
[ Team LiB ] |
No comments:
Post a Comment