1

I have build a website where multiple html pages are linked to a single CSS file.

Now I would like to remove all unused css from this single file.

Is there any way or tool to do it?

Here is my file structure:

index.html 
about.html
contacts.html

They all have the same

style.css

How to remove unused css from the style.css without braking everything?

Pro Girl
  • 762
  • 7
  • 21
  • You can find your answer here: [Google Chrome has a two ways to check for unused CSS.](https://stackoverflow.com/questions/4361007/is-there-a-way-to-check-which-css-styles-are-being-used-or-not-used-on-a-web-pag#:~:text=Google%20Chrome%20has%20a%20two%20ways%20to%20check%20for%20unused%20CSS.) –  Sep 11 '22 at 11:07
  • Hi, that does not solve my issue, which is to remove from a single css file all unused one by all htmls file. That just shows page by page which one is unused. – Pro Girl Sep 11 '22 at 11:22

1 Answers1

0

You can store 'shared' styles to one file (for example global.css) linked to all pages you have, and for each page use stylesheet with CSS you use on that specific page (for example about.css on about.html page).

  • the whole point to keep a single css is so not to do that. – Pro Girl Sep 11 '22 at 14:33
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 16 '22 at 10:23