Firefox addon to find Unused CSS styles

22,414

If you use Firefox, you can use the Dust Me Selectors plugin that does exactly what you asked for. It finds unused Selectors for you :) Give it a try!

Also there is the CSS Usage plugin, that looks over your CSS file and tells you which ones are not being used. :)

Share:
22,414
copenndthagen
Author by

copenndthagen

Buy some cool JavaScript related merchandise from; https://teespring.com/stores/technical-guru-2

Updated on August 23, 2020

Comments

  • copenndthagen
    copenndthagen over 3 years

    Possible Duplicate:
    Tool to identify unused css definitions

    Lets say I have a page displayed in my browser and I have a .CSS file used on this page with rules like

        .class1{
        /* some style definitions */
        }
        .class2{
        /* some style definitions */
        }
        .class3{
        /* some style definitions */
        }
    ....
    ...
    .class1001{
        /* some style definitions */
        }
    

    Now my question is is there any addon which would tell me like out of these rules, which are "NOT USED" on the page..

    I saw some related questions which provide links to addon that tell CSS selectors which are used on a page..But I have like 1000+ rules and hence want to directly know RULES which are NOT used..

    JUST TO ADD, the addons mentioned have 1 issue; Like if there are hacks for IE (e.g. *html), it marks them as UNUSED, even though it is actually used in IE. Is there any workaround for this ?

    Please help me. Thank you.

  • copenndthagen
    copenndthagen over 12 years
    Thx a lot... Dust Me Selectors does not seem to be working for Firefox 4.0.1...So I have installed CSS Usage ...It says Seen, Unseen,..So I assume the selectors in red (i.e. Unseen) can be safely deleted...Could you please confirm..
  • Kyle
    Kyle over 12 years
    They can if all of the selectors used on the current page are used in every page throughout your site. you may end up having deleted some that are used on other pages.
  • copenndthagen
    copenndthagen over 12 years
    Oh k...right..actually in my case, I only have the CSS called on a single page...There is one issue though which I wanted to highlight...I have some CSS hacks which are alse used for IE like *html , >html, etc...And those are marked as RED (coz Firefox never understands them)...So do you have any workaroun d for this ...OR some other addon which handles this issue..
  • Lonnie Best
    Lonnie Best over 5 years
    Does anything work in the latest stable version of Firefox?
  • Andrii Kovalenko
    Andrii Kovalenko about 4 years
    The links are broken
  • Kyle
    Kyle about 4 years
    @Andrii well this is a 9 year old answer, I'm not surprised.