Top 10 Tips for Optimizing CSS Seo

The following 10 best practices are designed to speed-optimize your CSS, and your
HTML markup:
1. Replace inline style with type selectors to target multiple instances of identical
elements.
2. Use descendant selectors to avoid inline classes.
3. Group selectors with common declarations.
4. Group declarations with common selectors.
5. Combine common styles into shared classes.
6. Use inheritance to eliminate duplicate declarations.
7. Use CSS shorthand to abbreviate rules and colors.
8. Abbreviate long class and ID names.
9. Use CSS2 and CSS3.x techniques.
10. Replace JavaScript behavior with CSS techniques.
In addition, you can eliminate extraneous whitespace by removing tabs, comments,
and returns.

Tip #1: Replace Inline Style with Type Selectors
This section starts with simple type selectors to streamline markup, and then it
moves through grouping, inheritance, and CSS shorthand, and finally to some
applied techniques to replace JavaScript behavior.

Web pages that use inline style pepper HTML code with unnecessary font and style
tags. This effectively hardcodes the presentation directly within the HTML. Unless
the style is used only once, it is more efficient to create a CSS rule and target all elements
of a certain kind with type selectors (i.e., p, ul, h2, etc.). For example, this:
<h2 style="font-size:1.2em;color:red;">Little red Corvette</h2>
<h2 style="font-size:1.2em;color:red;">Baby you're much too fast to embed</h2>
<h2 style="font-size:1.2em;color:red;">Little red Corvette</h2>
<h2 style="font-size:1.2em;color:red;">You need a love that's gonna last</h2>
becomes this, by abstracting the inline style to a block style:
<style type="text/css"><!--
#main h2{font-size:1.2em;color:red;}
--></style>
The corresponding HTML cleans up to this:
<div id="main">
<h2>Little red Corvette</h2>
<h2>Baby you're much too fast</h2>
<h2>Little red Corvette</h2>
<h2>You need a love that's gonna last</h2>
</div>
Note how clean the code becomes after you remove the inline styles. This CSS technique
also helps search engine optimization (SEO) by boosting keyword density and
prominence.