Question

I understand that CSS style sheets are cached in browser. My question is, why? CSS is usually only kilobytes, so what is the benefit of caching something that small when it can prove so bothersome to update? My only guess is that browsers like CSS to be loaded before HTML so unstyled elements are not flashed.

Was it helpful?

Solution

Every CSS file is a HTTP request. Many requests means slower page loading. Browsers developers cannot be sure that the websites developers will create one minimized CSS file with less useless lines. Often websites contains dozens of css files, sometimes there are not kilobytes but megabytes. So the CSS caching part is really in service of websites developers.

OTHER TIPS

everything with a cache header can be cached. This is an overview of all headers.

If the css is used on every site of a domain, you have only one download. This save you bandwidth and the bandwidth of the domain owner

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top