One CSS File or individual CSS files for each page?

JCHASE11 picture JCHASE11 · Nov 28, 2009 · Viewed 33.9k times · Source

When I am building pages, do I want to have individual stylesheets for each page or one large stylesheet for the entire site? For loading purposes, wouldn't individual files be a better practice because it would be less total css on load?

Answer

Ben Everard picture Ben Everard · Nov 28, 2009

Use a single file, CSS files are cached and therefore reduce the need to download a new file for each new page visited.

To help, I usually slap my CSS through a CSS cleaner to reduce its file size, additionally you can GZip CSS using .htaccess too, making it smaller yet again.

Finally putting all CSS in a single file will make making system wide changes to presentation easier in the future (the entire reason we use CSS in the first place), it will also make debugging easier.

Edit, May 2017

A lot has changed in 7+ years, and anyone looking at this answer should consider researching newer asset delivery methods, especially now use of HTTP2 and preprocessors are more commonplace.