Reputation: 47
I'm doing the old CSS conditional comments to block out a .css from being used when using IE 7 and below using:
<!--[if gt IE 7]>
<link rel="stylesheet" href="some-styles.css" />
<![endif]-->
However, this prevents this .css from being used in non IE browsers. This is the first time I've come across this.
I've seen the use of conditional comments targeting non IE browsers exclusively but surely there must be another way?
Upvotes: 1
Views: 1550
Reputation: 1179
Conditional comment should only be used to target IE browsers. I don't think any other browsers support this "feature".
I would suggest that you put all your styles into a main style that all browsers can see and then using the conditional statements for pre-IE 8 browsers to add/remove any style declarations that don't work on those browsers.
Upvotes: 0
Reputation: 700372
To make it visible for non-IE browsers, remove the comment delimiters --
, as outlined here: http://msdn.microsoft.com/en-us/library/ms537512%28v=vs.85%29.aspx
Like this:
<![if gt IE 7]> <link rel="stylesheet" href="some-styles.css" /> <![endif]>
Upvotes: 2