Pergunta

IE allows you to do detect which version of IE is running based on their browsers comment conditions (I actually don't know if that is what they are called, someone can correct me if it is not).

<! --[if lt IE 7]> css code here.. <! [endif] -->

Does anyone know if other browsers have followed their example to determine what version of thier browser is being used?

<! --[if FF]> css code here.. <! [endif] -->
<! --[if O]> css code here.. <! [endif] -->
Foi útil?

Solução

In general, you shouldn't need to do this with modern browsers (FF3.6, Chrome, IE9, Safari). Also, if you target a hack at a browser that is still changing, you run the risk of the hack still working but the problem it solved being fixed, and then your fix breaks.

Hacks or conditional comments should only be aimed at old browsers (IE6 and IE7 are the main targets).

Outras dicas

No, conditional comments are only supported by Internet Explroer and the list of available conditions is quite astounding.

Note that you can use conditional comments to hide things from IE browsers in general:

<!--[if !IE]><!-->
<b>This HTML is not seen by IE</b>
<!--<![endif]-->

Ugly, ugly, though...

Not that I'm aware of. Are you trying to serve up different CSS or a combo of CSS and JS/other?

Perhaps using the vendor prefixes like -moz-, -webkit- and -o- before CSS declarations might work for you in that case.

Nope,

conditional comments are IE only.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top