views:

94

answers:

5

Is this idea good? instead of making different conditional stylesheet for different versions.

One conditional css for all IE version

<!--[if IE]>
 <link rel="stylesheet" type="text/css" href="all-ie-only.css" />
<![endif]-->

and for example this is content of all-ie-only.css

selector {  
 color : green\9; /* IE8 and below */  
*color : yellow; /* IE7 and below */  
_color : orange; /* IE6 */

}
A: 

Hi Metal-gear-solid,

The advantage I see in this technique is that you have just one style sheet in your server which may be easier to maintain.

The disadvantage is that users will need to download the whole file which may be 3 times bigger hence taking more time to download and to process.

Appart from that, I think there's no other issues with it.

XaviEsteve
A: 

hi, this is right to use this for all IE Version. but when you use this then you will find that, this is not w3c valid. Generally IE create problem.Safari, Chrome , and Firefox will run these good.I think this is better idea to use one Css for all IE version.

kc rajput
A: 

As long as it works and its valid, then it doesn't really matter whether its in 1 file or 3, its just personal preference.

Personally, I prefer to have a seperate sheet for each IE version (if needed), as I find it easier to organise.

Like I said, if its W3C complient (god, don't we just love them), then its all good.

thebluefox
A: 

Yes, it's fine. I think it becomes a question of how many items the file has to hold. If you're just overriding 1/ 2/ 3 things, the single file makes much more sense. At some arbitrary point (10 things? 100 lines of code), I'd say the trade-off swings the other way and it's simpler to maintain the three files.

Tom
A: 

What if IE 10 comes along and invalidates some of these hacks? I think this approach defeats the purpose of using IE conditional comments in place of hacks, that being more of a future-proof implementation.

Plus is there any advantage, besides slightly easier maintenance, and negligible HTML file size savings? As LuckyShot mentioned, it's already a detriment for IE users which will have to download a larger browser-specific file.

Andrew