Dougal
Dougal

Reputation: 1067

Any tools to identify undefined CSS/HTML classes?

Are there any tools out there that can look at my website HTML and tell me that (for example) "there is an HTML element at mysite.com/example.html using a class of SOMECLASS but SOMECLASS is not defined in any included CSS files".

?

Upvotes: 16

Views: 3915

Answers (4)

djk
djk

Reputation: 973

There is a free Windows desktop tool that can scan a local web project folder and output undefined css classes, i.e. classes that are used in html but are not defined in any css. It also takes JavaScript into account to some degree.

https://sourceforge.net/projects/cssscanner/

enter image description here

All other answers either didn't work for me or didnt understand the question (including the accepted answer). This one I just tested myself and it works surprisingly well, though it won't catch every edge case.

Upvotes: 0

marcgg
marcgg

Reputation: 66445

You could try out a Firefox plugin like Dust-me-selectors

Upvotes: 2

Konrad Dzwinel
Konrad Dzwinel

Reputation: 37903

I've created a snippet that does exactly that: https://gist.github.com/kdzwinel/426a0f76f113643fa285

You can run it in the DevTools console and the sample output will look like this:

Sample output from the CSS un

Upvotes: 13

Galwegian
Galwegian

Reputation: 42237

You could try inspecting with Firebug

Upvotes: 0

Related Questions