Serving a Large CSS File

I have a large mini CSS file about 50k in size that links to about 30 pages.

Separates CSS into one base file with separate CSS files for each page, which significantly reduces loading time or maintains one large file almost the same? Thanks.

+4
source share
4 answers

50k is really not that big - especially with most internet connections.

I would save a single file because:

  • You only need one HTTP request to load all CSS
  • CSS will be loaded for your entire site as soon as one page is visited (which is nice for further viewing)

The use of sprites will be a similar theme - this is essentially the same as a single large file containing several images, currently many smaller images are favorable.

+4
source

I'm not quite sure what you mean, but serving one large file and caching it is definitely the way to go - ideally, it will only trigger one HTTP request per client.

+5
source

Assuming that most of the css is used by each page, the ideal way to serve it is to have a large file. HTTP requests take time, so downloading a few small files requested on a page takes some time, not to mention that the number of simultaneous connections is limited. Secondly, and more importantly, proper caching means that they only need to download the entire file once.

0
source

Yes, dividing them into each page will reduce the loading time for each page, since each page will pull only the necessary CSS.

-1
source

All Articles