Multiple css files or one big css file?
Question by Alex90
Which one is better and faster? why?
using only one file for styling:
css/style.css
or
using several files for styling:
css/header.css
css/contact.css
css/footer.css
css/tooltip.css
The reason Im asking it is that im developing a site for users who have very low internet speed. country uganda. So I want to make it as fast as possible.
Answer by hustlerinc
Using a single file is faster because it requires less HTTP requests (assuming the amount of styles loaded is still the same).
So it’s better to keep it in just one file.
Separating CSS should only be done if you want to keep for example IE specific classes separate.
Answer by Starx
As per Yahoo’s Performance Rules [source], It is VERY IMPORTANT to minimize HTTP requests
From the source
Combined files are a way to reduce the number of HTTP requests by combining all scripts into a single script, and similarly combining
all CSS into a single stylesheet. Combining files is more challenging
when the scripts and stylesheets vary from page to page, but making
this part of your release process improves response times.
It is quite uneasy to develop using combined files, so stick to developing with multiple files but you should combine the files once you are deploying the system on the web.
I really recommend using boilerplate’s ant build script. You can find it here.
It Combines and minifies CSS