Home > Mobile >  How to find all unused classes and ids in HTML?
How to find all unused classes and ids in HTML?

Time:10-13

I have many classes and ids in my long HTML that don't have CSS code linked to them, and it would be very tedious to look up for each one of them to see whether they do.

I want to delete all unnecessary ones. Is there an easy way to do it?

CodePudding user response:

Chrome Developer Tools has an Audits tab which can show unused CSS selectors.

The downside to this is that you will have to run it on each page if I remember correctly

CodePudding user response:

You can apply JavaScript for that you can visit this link. Again Be wary that they may be used in javaScript files. [1]: https://css-tricks.com/detect-unused-classes-in-html/

  • Related