Combining all CSS into one StyleSheet

In my application, I have different browser specific css. As separate for IE6, IE7, etc ... also for Right to Left (languages) we have different CSS.

My question is: is it possible to combine all CSS into one stylesheet.

And will it reduce response time?

Thanks in advance!

+7
source share
4 answers

Yes, it is possible to merge all CSS files into one CSS file. You can import any number of additional stylesheets into the main css file, for example:

@import url('ie6.css'); @import url('ie7.css'); @import url('ie8.css'); 
+2
source

You can write css using hacks that run a specific property only in a specific browser.

how

 *color: black; /* for IE7 and below */ _color: black; /* for IE6 and below */ 

But this will be a pain for mantain, and will also not check your css anymore. Although you are reducing requests (by 1 or 2?), I still don't see a problem if you use conditional comments to load a CSS browser for IE6 for exaple. It will still add another 1 query, which is actually not so much. And if you think that IE6 is being used less and less, perhaps only 10% of your users will actually make this request.

+2
source

If you use separate css files for different browsers, you should just download the specific browser CSS file. In this case, you will not see significant savings by combining them. In general, you should try css, which works in browsers.

0
source

Possible? Yes. Practical? Not so much. Especially when it comes to a particular CSS browser. You can use css hacks, but IMHO is a pretty ugly thing that spoils the readability of css. Instead, I would use conditional comments conditional comments . That is, for IE - for the rest of the world, try using one correct css.

As for reducing time, no matter how much you use the download speed of loading static css files, it would be insignificant. Static files are mostly cached, so you only save a couple of queries that return only "Not Modified".

0
source

All Articles