View Full Version : CSS software to find unused class/ID selectors
01-14-2004, 07:15 AM
Sometimes I find in my CSS file I have unused selectors in my "core" CSS files. Does anyone know of some software that you can give it a CSS file and then it will search the desired directory for any unused selectors?
01-26-2009, 07:54 PM
Found this today looking for a was to find redundancies and unused CSS rules in my code. I have adopted a technique they call divide and conquer. Split all my CSS rules up into different categories and separate them from my pages. I use import in the head of my pages.
Scroll down a bit to the "Cascading Style Sheet Tools" section and you'll find stuff for validation, cleaning, optimizing, file reduction very handy resources.
You'll have to sort out what is useful and not, also note that some links are dead. :-(
01-26-2009, 08:06 PM
If you have IE with developer toolbar, under View there's an option called CSS Selector Matches. It will show you your style rules and tell you how many elements are matched by each rule.
01-26-2009, 08:08 PM
I've never found anything that will find them all at once.
I've used DreamWeaver with some success:
with all .html pages open
click Edit/Find And Replace
click the little box at the top that says Find in Open Documents
in the Find box type/paste the selector your checking
click Find Next
I'm sure you could do the same with NotePad or most any other editor.
I know it's only one selector at a time but it works.
02-18-2011, 05:27 AM
2 year old thread. I wonder if the FireFox plugin was made back then... I don't know the name of it but there is one. Pretty sure it's an ff plugin.
I had it at one time... Worked well for what you want to do.
02-18-2011, 10:10 PM
This one? CSS Usage (https://addons.mozilla.org/en-US/firefox/addon/css-usage/) It's still on the Firefox add-ons site but it looks like the developer forgot to renew his domain name as the add-on's homepage has gone missing. This is a Firebug plug-in.
02-18-2011, 11:00 PM
BEWARE!! The link that Loup0999 added is ok, but links on that page have malware. Surf at your own risk!!!!!!!
02-20-2011, 02:53 PM
I personally use a tool called Unsed-CSS (http://unused-css.com). I find it easier. You don't even have to install an extension and it works on any browser.
I use a FF plugin called Dust-Me Selectors (http://www.sitepoint.com/dustmeselectors/) which will allow you to run a check for a whole site.
Silly name though...
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.