Friends, please help me in defining specific css rule for IE9? For example like this
/* IE 6 fix */
* html .twit-post .delete_note a { background-position-y: 2px; }
* html .twit-post .delete_note a:hover { background-position-y: -14px; }
Friends, please help me in defining specific css rule for IE9? For example like this
/* IE 6 fix */
* html .twit-post .delete_note a { background-position-y: 2px; }
* html .twit-post .delete_note a:hover { background-position-y: -14px; }
I think you can do the same as if you want to write specific code for IE6 but say IE9 instead :)
You can prepend the CSS style with
to make it IE9-specific, like this:
Note the accepted answer also targets IE10. As such, for a more complete list:
IE 6
or
IE 7
or
IE 6 and 7
or
or
IE 6, 7 and 8
IE 8
or
IE 8 Standards Mode Only
IE 8,9 and 10
IE 9 only
IE 9 and above
IE 9 and 10
IE 10 only
IE 10 and above
or
IE 11 (and above..)
Javascript alternatives
Modernizr
User agent selection
The Javascript:
Adds (e.g) the below to the
html
element:Allowing very targetted CSS selectors, e.g.:
Footnote
If possible, avoid browser targeting. Identify and fix any issue(s) you identify. Support progressive enhancement and graceful degradation. With that in mind, this is an 'ideal world' scenario not always obtainable in a production environment, as such- the above should help provide some good options.
Attribution / Essential Reading
\9 is a "CSS hack" specific to Internet Explorer.
This simply means that the one specific line of CSS ending with a \9;
In your example, If your CSS looked like this...
The result would be background-position-y: -14px; in IE 9
use conditional CSS: (place the code above the
<head>
on your html, and IE9 will read that extra CSS file)This means the approach is with a new CSS file rather than a hack in the classes, this guarantees the CSS are valid.
I found that in some cases using negative values (when using a compiler to compile LESS files) using: