Reputation: 55623
Sometimes on completely valid browsers, but a hindered Internet connection, the webpage loads without some of the external css files, resulting in a ugly webpage. Is there a way to prevent this without resorting to embedding all of the css in the html?
Upvotes: 0
Views: 253
Reputation: 3000
A general rule of performance is to reduce the number of HTTP transactions. This is particularly important in these days of add-ins. Each HTTP transaction adds an overhead of about 1kB up and down by adding the headers. It adds load on the server and delays rendering. It also opens up the risk of network timeouts -- especially a problem on 3G phone networks.
Regarding CSS, it's better to have a single larger file than lots of smaller ones to avoid exactly the problems you're experiencing. If you minify the file -- but don't optimise it -- it will also get rid of the comments and white space.
Similarly it's worth combining jQuery addins into a single file for the same reasons.
Upvotes: 0
Reputation: 92803
Try to use less css files as much as possible because ever single css files send different http request so, when there are less css files that means less http request .Which automatically increase the speed & minify the css also .
Upvotes: 1
Reputation: 50019
I guess you might be hitting the timeout when hitting the CSS file. You might try caching the CSS file on the client side by using far future headers. And minify the CSS so it has a small file size and can be quickly grabbed.
Upvotes: 3