Is there a way to check which CSS styles are being used or not used on a web page?

Css

Css Problem Overview


Want to know which CSS styles are currently being used on a web page.

Css Solutions


Solution 1 - Css

Google Chrome has a two ways to check for unused CSS.

1. Audit Tab: > Right Click + Inspect Element on the page, find the "Audit" tab, and run the audit, making sure "Web Page Performance" is checked.

Lists all unused CSS tags - see image below.

Screen Shot of Chrome's Audit Tool

Update: - - - - - - - - - - - - - - OR - - - - - - - - - - - - - -

2. Coverage Tab: > Right Click + Inspect Element on the page, find the three dots on the far right (circled in image) and open Console Drawer (or hit Esc), finally click the three dots left side in the drawer (circled in image) to open Coverage tool.

Chrome launched a tool to see unused CSS and JS - Chrome 59 Update Allows you to start and stop a recording (red square in image) to allow better coverage of a user experience on the page.

Shows all used and unused CSS/JS in the files

  • see image below.

Example of Coverage tool in Chrome

Solution 2 - Css

Install the CSS Usage add-on for Firebug and run it on that page. It will tell you which styles are being used and not used by that page.

Solution 3 - Css

Just for completeness and because it was asked in the comments - there's also the CSS audit tool in Chrome now for the same purpose. Some details here:

http://meeech.amihod.com/very-useful-find-unused-css-rules-with-google

Solution 4 - Css

Take a look at UnCSS. It helps in creating a CSS file of used CSS.

Solution 5 - Css

I'm using CSS Dig. It is made for chrome, but I think it is a great tool!

Solution 6 - Css

Without any third-party tools and any app, you can find unused CSS and javascript by using chrome dev tools in the coverage tab. read the post below from google developers.
chrome coverage tab

Solution 7 - Css

Try using this tool,which is just a simple js script https://github.com/shashwatsahai/CSSExtractor/ This tool helps in getting the CSS from a specific page listing all sources for active styles and save it to a JSON with source as key and rules as value. It loads all the CSS from the href links and tells all the styles applied from them You can modify the code to save all css into a .css file. Thereby combining all your css.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHELPView Question on Stackoverflow
Solution 1 - CssCordellView Answer on Stackoverflow
Solution 2 - CsskobeView Answer on Stackoverflow
Solution 3 - CssJan PetzoldView Answer on Stackoverflow
Solution 4 - CssRobert BrisitaView Answer on Stackoverflow
Solution 5 - Csscs.matyiView Answer on Stackoverflow
Solution 6 - CssMahdi SafariView Answer on Stackoverflow
Solution 7 - CssShashwat SahaiView Answer on Stackoverflow