开发者

Conditional Statements Inside Stylesheet To Target IE

I'm familiar with the html conditional tags

<!--[if IE]><![en开发者_如何转开发dif]-->

Because of various issues I need to use a single stylesheet. So I cannot use the above solution. I can't find hacks that work to target only ie9 browsers so I need an alternative.

I remember seeing once a condition used in a stylesheet that only IE understood. Something with an @ sign and 'MS'. It was awhile ago.

Does anyone know about this? Can it be used for browser specific (ie only) styling?


OK this is about the BETA and PREVIEW's of IE9, but maybe these will work for the full release also?

http://archivist.incutio.com/viewlist/css-discuss/112904


<body>
<!--[if IE 9]><div id="ie9"><![endif]-->
... your page here ...
<!--[if IE 9]></div><![endif]-->
</body>

with a css like

#ie9 #wrapper { background-color: blue; }

will make a blue background only in IE9, all other browsers won't find <div id=ie9> since its hidden in the comments. that should do the trick :)

See also Wikipedia on Conditional comments for an in-detail explanation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜