CSS conditional comments for other Browsers except IE?


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?


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.


<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>.


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?


There are not conditional comments for other browsers only IE and versions of IE.

You can using Javascript do checks for other browsers and apply styles as follows.

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).


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).


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]-->


  • Make HttpPost request to an action method in an ASP.NET MVC controller
  • Can undefined behaviour cause an exception in a function defined as never throwing an exception?
  • Three.js picking is not working correctly with custom geometry
  • org.springframework.core.convert.ConverterNotFoundException: No converter found capable of convertin
  • Variable amount of columns returned in mysqli prepared statement
  • isotope shakes after the transition
  • How to add a progress ring to the splash screen in Windows 8?
  • IOS - Facebook SDK fbDidLogin not called — initialize view controllers.
  • maximizing profit for given stock data via DP
  • Shell script to execute nohup against an inputed filename
  • How to position a Widget at the bottom of a SingleChildScrollView?
  • handlers inside a component invoking eachothers code by mistake
  • web2py: How to execute instructions before delete using SQLFORM.smartgrid
  • Draw ring with given thickness, position, and radius. (Java2D)
  • Preloading webView doesn't work - trying to reduce loading time
  • Oracle REF can't go through
  • connect.cookieParser and connect.session
  • Complex multiple if statements
  • Dynamically change JavaFX css property
  • Unity Resources.load() won't work with external dll
  • How to display content depending on dropdown menue user selection
  • Splitting ReportLab table across PDF page (side by side)?
  • How to use Typescript with libraries like Ampersand.js that parse configs to build prototypes
  • Find angle of point on circle
  • Cloud Code: Creating a Parse.File from URL
  • Terminal run dalvikvm with am.jar
  • How to handle div that is created dynamically in a table
  • Bad automatic Triangulation with Mayavi for coloring a surface known only by its corner
  • Make checkout phone field optional for specific countries in WooCommerce
  • customize soft keyboard key preview
  • Using Service Component Runtime
  • How to use FirstOrDefault inside Include
  • PHP Permalinks.. how to change?
  • media foundation H264 decoder not working properly
  • Running R's aov() mixed effects model from Python using rpy2
  • Access to a Matlab gui from the web
  • Simple stitching in c++ using opencv
  • ReferenceError: TextEncoder is not defined