So far I know, the conditional comments are only supported for different Versions of IE.
Likeways, can we provide conditional comments for other browsers too.
If Yes, How? If no, what could be the best alternative?Answer1:
Check out the <a href="http://rafael.adm.br/css_browser_selector/" rel="nofollow">CSS Browser Selector plugin</a>. I use it on my site, you basically just write the CSS and tell which browser you want it to target. I use it on my site and it works great!
Hope it helps.Answer2:
<a href="http://msdn.microsoft.com/en-us/library/ms537512%28VS.85%29.aspx" rel="nofollow">CSS Conditional Comments are meant only for IE.</a>. However, you can detect Firefox:
If the following code fails to exclusively detect Firefox..
<!--[if !IE]> ...statements... <![endif]-->
Use "Downlevel-revealed Conditional Comments" to get it working...
<![if !IE]> ...statements... <![endif]>
Example to force Firefox to use an exclusive css..
<![if !IE]> <link href="css/ff.css" rel="stylesheet" type="text/css" /> <![endif]>
Having said that, you should not be much worried about other browsers which are <strong><a href="http://en.wikipedia.org/wiki/Standards-compliant" rel="nofollow">standard-compliant</a></strong>.Answer3:
As far as I know, CSS conditional statements are an IE exclusive. They should not be needed for other browser since they follow standards reasonably well. Why would you need them?Answer4:
There are not conditional comments for other browsers only IE and versions of IE.
You can do a check for the browser to not be IE with conditional comments but just <strong>no</strong>.
I would suggest visiting <a href="http://www.w3.org/" rel="nofollow">W3.org</a> and building your site to be functional with a standard conforming browser then use the conditional comments to fix up how it loads in IE if there are issues (there usually is).Answer5:
As noted in other answers there are no conditional comments for browsers other than IE. Using JS detection is the way to go here.
If you want to have the commented element affect the IE condition AND other browsers then simply do this:
<!--[if gt IE 8]><!--> <link href="sample.css" rel="stylesheet" type="text/css" /> <!--><![endif]-->
As you can see from the syntax highlighting the link element is not commented out so it will be visible for non-IE browsers and for IE it will follow the condition (greater than IE 8 in this example).Answer6:
I wish there was a solution to this, especially for email rendering engines. There are even conditional comments for outlook, but none for Gmail.
<!--[if gte mso 9]> <![endif]-->