The question can be funny, but it isn't for me..

I try to optimize my website and for thath i use "Yslow".

Yslow tell me that :

"43.2% of CSS (estimated 14.4kB of 33.2kB) is not used by the current page."

How can you make a website using css whitout unused css ?

Because i have form, table, (I also use Jquery Ui ) ... i have css for this but i don't use it anytime..

I don't want to cut my css by page.. it's the only solution ?

Could you help me please ?

(Sorry for my basic english.. )

Thanks you a lot !

7 answers

Alex Holt 341
This was chosen as the best answer

I'm not a big fan of tools like Yslow. From a purely pragmatic point of view i would say: 14k of unused CSS is not a big loss, so don't waste time trying to fix it ;)

The negatives of having only the CSS that is necessary on the page far outweigh the positives you gain by saving on 14k of space. You could move the Tables code into an external CSS file called tables.css and only include it on pages that need it for example... but then you have are making more HTTP requests, which is also bad...

Answered about 8 years ago by Alex Holt

There is an add-on for firefox that can help you clean up your css. Works great when you need to do some house-keeping.

Dust-Me Selectors

It extracts all the selectors from all the stylesheets on the page you're viewing, then analyzes that page to see which of those selectors are not used. The data is then stored so that when testing subsequent pages, selectors can be crossed off the list as they're encountered.

Answered about 8 years ago by Blake M. Scarbrough

You'd be better off making sure that your CSS is gzipped and keeping one huge file than making lots of small files for each page.

Answered about 8 years ago by Rich Bradshaw
John 0

I have built a tool that does that. It's called http:///unused-css.com This service will explore any site and find unused selectors/rules. You will then be able to download the clean CSS file.

Answered almost 7 years ago by John

The CSS Redundancy Checker is similar to the Dust-Me Selectors extension for Firefox.

Answered about 8 years ago by retlehs

The problem here is that YSlow is only considering the current page, and not the current site. The same ruleset that it is using to judge your site will also tell you it's best to only have one stylesheet and not multiple ones for caching benefits. If you have rules you know you're no longer using, kill them; otherwise do some minifying and server-side gzipping and you're good.

Answered about 8 years ago by Daniel Ryan

Have a look at this tool -> https://addons.mozilla.org/en-US/firefox/addon/10704 It shows you CSS usage and shows you exactly which CSS is being used

Answered about 8 years ago by VirusMinus