HOW TO: Find or remove unused CSS

Post here if your topic is about CSS HTML Validator but doesn't fit in another forum.
Post Reply
User avatar
Albert Wiersch
Site Admin
Posts: 3818
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

HOW TO: Find or remove unused CSS

Post by Albert Wiersch »

Unfortunately, finding unused CSS across multiple pages or an entire website is not easy. It's very possible and likely to remove "unused" CSS and then to discover that there's a page or script that was using it after all.

However, CSS HTML Validator can help you find unused inline CSS classes, IDs, and type selectors. While this is just a small part of trying to remove unused CSS in an entire website, it can still be useful.

Just make sure the 'Check for unused inline classes, IDs, and type sectors' option is checked in the CSS Checker page of the Validator Engine Options. This option is enabled by default and is in the Home, Pro, and Enterprise editions.

Image

Using Chrome DevTools, you can also view used and unused CSS with the Coverage tab.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
Post Reply