Page Speed: Remove unused CSS

Removing or deferring style rules that are not used by a document avoid downloads unnecessary bytes and allow the browser to start rendering sooner.

recommends:

  • Remove any inline style blocks containing CSS that is not used by the current page.
  • Minify CSS.
  • If your site uses external CSS files shared among multiple pages, consider splitting them into smaller files containing rules for specific pages.
  • If a page references style rules that are not needed right at startup, put them in a separate .css file and defer loading of the file until the onload event is fired
  • If you use JavaScript to generate styles, be sure that those functions aren't called from pages that don't use those styles. This may require some refactoring of JS code.

Read More

Have an idea for this recommendation?

Feel free to contact us with your suggestions, links or ideas!