Actually you go me interested in this idea of unused Classes and IDs. I'm guessing that's what Dust-Me is referring to. CSS Selectors and Sudo Selectors are a specific type of CSS sytax (
www.w3schools.com/cssref/css_selectors.asp
) but I'm sure it's looking at all ID's and classes.
It got me thinking about the type of speed I could actually save by removing the unused CSS so I ran a test on RocketTheme.com. I don't have a link to use your site, but I'd be happy to do the same for it.
Here's a compressed waterfall chart showing connection, TTFB, and download times for RocketTheme.com. It is visual representation of the total time taken to process the many elements of a site.
This image is hidden for guests.
Please log in or register to see it.
The CSS is small but certainly takes time to request, download, and process. One thing to point out is that the site's CSS files have no compression, meaning there is still room for improvement, so more time is need to process each file individually. But... typically up to six files can be processed simaltainiously so I predict that the improvement would not be significant.
Now... to illustrate the actual increase in speed one would get if some (or all) of the CSS were eliminated, lets look at another chart:
This image is hidden for guests.
Please log in or register to see it.
The CSS files (lines 3-7) take about 1.5 seconds to process completely, then the images are requested, and the page starts to render in the browser which is represented by the long vertical purple line. One thing you'll want to know about is that both the JavaScript and CSS files are processed before moving on to the rest of the content and rendering the page regardless of the browser used.
Now lets assume there isn't any CSS on the site at all and see what happens. In this illustration I've removed the CSS and I have marked difference of where the JavaScript originally started loading and where it loads after removing the CSS.
This image is hidden for guests.
Please log in or register to see it.
You can see that the JS starts as soon as the DNS lookup is complete and lasts as long as the longest JS file takes to process, THEN the rest of the site is requested and starts to render in your browser. Because the browser waits until all the JS files are completely processed to move on, even though the browser processes several (6 to be exact) files at once. Removing the CSS saves about 350ms.
This is really the first time I've paid attention to unused CSS. I don't think I can say that CSS should be a lower priority for all sites but most of the ones I've optimized for speed for have had weakness in other areas. I'm sure I'll find a site were it will make a significant difference.
kers7754 wrote:
I found that I am not using (and I am estimating here) about 90% of all the CSS selectors that are defined (and there are around 10,000 CSSselectors just on the front page of my site!).
Are they used anywhere else on your site?