Skip to main content

Remove Unused CSS to Reduce the Size of your Stylesheets

The CSS files of your website may have several redundant rules that are no longer used by any element on the web pages. For instance, you may have added a site search box on your website and associated styles went into the stylesheet. Later, if you decide to remove that search box, the styles may continue to exist in your CSS though they aren’t being used anywhere.

These unused entries in your CSS files increase the page load time of your website and also affect the site’s performance as the browser has to do extra work parsing all the extra rules. And even if the impact on performance is minimal, it would make your task of maintaining CSS easier if the files are kept clean and well-structured.

Opera and the Firefox browser have a popular add-on called Dust Me that scans your current web page and lists all the unused CSS rules that are defined in the stylesheet but not used on the page. Google Chrome users however do not need to install any add-ons as the Developer Tools built inside the Google browser itself offer this option.

Unused CSS Audit

Remove Unused CSS from the Stylesheet


Here’s how you can easily find all the unused selectors in your CSS files in Google Chrome:

  1. Open any page of your website inside Google Chrome and then launch the Dev Tools available under File -> Tools -> Developers Tools.

  2. Click the Audits tab inside Dev Tools and select the “Web Page Performance” and “Reload Page and Audit on Load” options. Now click the “Run” button to begin the CSS audit process.

  3. On the results page, expand the “Remove Unused CSS Rules” group and select the CSS file(s) that are linked from your site. You may ignore the CSS files added by social plugins and widgets since you do not have control over them.


Here you will get a sorted list of all styles that are defined in the CSS file but not used anywhere on the current page.

You can copy and save the results in a text file and repeat the steps for couple of other pages on your site. This is essential as not all selectors may be used on all pages. You can find the count of various selectors in the combined resultset, maybe using Google Sheets, and the selectors with the highest count can probably be “safely” removed.

Remove Unused CSS to Reduce the Size of your Stylesheets

Comments

Popular posts from this blog

7 Data Recovery 2.3.0 Enterprise Serial Keys are Here ! Comprehensive Data Recovery Software for All Your Needs

Recover Your Data Efficiently and Effectively 7 Data Recovery is a complete and capable data recovery software designed to rescue your files under almost any conditions. Whether you've accidentally deleted files, have a damaged or formatted hard drive, or lost data from mobile devices, 7 Data Recovery has you covered. Main Features Accidentally Deleted Files Recovery:  Quickly recover files that have been mistakenly deleted. Complete Recovery from Local & External Drives:  Restore data from both internal and external storage devices. Recover Data from Lost and Deleted Partitions:  Retrieve data from partitions that have been lost or deleted. Recovery of Photos, Images, Videos, and Audio:  Recover various media files from different sources. Mobile Phone Recovery on Windows:  Extract lost data from your mobile devices using a Windows PC. Memory Card Recovery:  Recover files from memory cards used in cameras, phones, and other devices Download and Registra...

Revo Uninstaller Pro 3.0.8 (Latest) Crack is Here ! The Ultimate Solution for Software Removal

Revo Uninstaller Pro helps you effortlessly uninstall software and remove unwanted programs installed on your computer! Even if you face issues uninstalling programs via the default “Windows Programs and Features (Add or Remove Programs)” control panel applet, Revo Uninstaller Pro is your go-to solution. Why Choose Revo Uninstaller Pro? Revo Uninstaller Pro is a faster and more powerful alternative to the “Windows Programs and Features (Add or Remove Programs)” applet! It comes packed with powerful features to ensure complete uninstallation and removal of programs. Key Features of Revo Uninstaller Pro Extended Scanning for Leftovers: Advanced algorithms ensure no remnants are left behind. Real-Time System Monitoring: Track system changes during program installation. Forced Uninstall: Remove remnants of already uninstalled programs. Quick/Multiple Uninstall: Quickly uninstall one or multiple programs in a row. Logs Database Usage: Integrate with a database of installation logs for a be...

Auslogics BoostSpeed Premium 7.3.1.0 Serial Keys are Here ! [Latest]

Auslogics BoostSpeed 7 AusLogics BoostSpeed : the ideal solution to keep your PC running faster, cleaner and error-free. This powerful optimization suite will boost Internet connections, tweak Windows to its peak performance, clean registry and block annoying ads. It’s a great way to keep your computer clean and optimized. Modify Windows settings, file system and services to greatly increase system performance. Increase startup and shutdown speed, disable annoying CD autorun and error reporting features. BoostSpeed will keep monitoring your system for possible optimizations and let you know if such optimizations are possible. You can also run the System Optimization Wizard to periodically optimize your PC. Speed Up PC With BoostSpeed Modify Windows settings, file system and services to greatly increase system performance. Increase startup and shutdown speed, disable annoying CD autorun and error reporting features. BoostSpeed will keep monitoring your...