Since IE is getting rid of conditional comments in version 10, I'm in dire need to find a "CSS hack" targeting IE10 specifically. Note that it has to be the selector that's getting "hacked" and not the CSS-properties.
In Mozilla, you can use:
@-moz-document url-prefix() {
h1 {
color: red;
}
}
While in Webkit, you usually do:
@media screen and (-webkit-min-device-pixel-ratio:0) {
h1 {
color: blue;
}
}
How would I do something similar in IE10?
As far as I know, no such CSS selector exists. If you want to target IE10 specifically, why not just write a bit of javascript to set a class on the
body
element calledie10
, then create a specific styles for IE10?Using the css browser selector from http://rafael.adm.br/css_browser_selector/ you can add a simple + to the code and call out IE10 from your CSS.
Look for
/msie\s(\d)/
and change it to/msie\s(\d+)/
.Now in your CSS just add
.ie10
before your selector like so:.ie10 .class-name { width: 100px; }
.class-name { width: 90px; }
You should now see IE10 rendering the 100px width and all other browsers rendering the 90px width.
I'm not sure if this fits your selector vs property requirements but I came up with the following method while trying to fake
text-shadow
in IE7-9 and then turn off the hack in IE10. The key is to use the new-ms-animation
stuff in IE10.The following example shows how to do this
Warning: will probably work in IE11+, too.