Is there css hack for all IE browsers. Not specific IE versions.
I tried
@media \0screen\,screen\9 {
body { background: green; }
}
but it doesn't work in IE7 and IE11.
Is there css hack for all IE browsers. Not specific IE versions.
I tried
@media \0screen\,screen\9 {
body { background: green; }
}
but it doesn't work in IE7 and IE11.
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="all-ie-only.css" />
<![endif]-->
more information can be found here: http://css-tricks.com/how-to-create-an-ie-only-stylesheet/
UPDATE as ElKabong mentioned in the comments and you will read while following the link..
Note that IE 10 and up DO NOT support conditional comments at all so this seems to be a bit of a nightmare and I have no easy way solution right now for that. But you can find more information while following the link mentioned above and also read trough the comments.
I would just the HTML Conditional Comments
<!--[if IE]>
<style>
body { background: green; }
</style>
<![endif]-->
Maybe the following media-queries will help you:
/* <= IE 7 */
@media screen\9 {}
/* IE 8 */
@media \0screen {}
/* >= IE10 */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {}
Important: For IE9 and above Read this:
https://stackoverflow.com/a/15442638
In some cases it's better to enable certain features only for the following (other) browsers:
/* WebKit */
@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution: .001dpcm) { .selector {} }
/* Opera >= 12 */
@media (min-resolution: .001dpcm) { _:-o-prefocus, .selector {} }
/* Firefox > 4 */
@media screen and (min--moz-device-pixel-ratio:0) {}
I've had the same problem, when inplementing an svg-animation file. I wanted to exculde all IE versions and use a gif-animation for them instead, because no IE version does support animated SVG files. But look at this:
http://caniuse.com/#feat=svg-smil
As you can see in my case it is better to implement an animated gif as default and use the SVG only for the "other" browsers listed above.
I've found those media-queries on http://browserhacks.com/
No you cannot do all of IE in one media query as none have been found/created for all versions of Internet Explorer yet, but you can split it into two different CSS groups. Here is one method:
This one works in 8 and newer:
/* Internet Explorer 8+ (Media Query) */
@media screen\0 {
body { background: green; }
}
Like yours this really is a css hack. IE 9 officially supports media queries, but IE 8 and below are fooled into allowing them to work via hacks.
Here is one for IE 7 and below:
/* Internet Explorer 7- (Media Query) */
@media screen\9 {
body { background: green; }
}
If that doesnt work for you, try another IE 7 one here:
/* Internet Explorer 7- (Another Media Query) */
@media, {
body { background: green; }
}
There are many ways to do an IE 7 hack.
Try this. It's a css hack tested from IE 7 to 10:
@media all and (-ms-high-contrast:none)
{
.myClass { myProperty: myValues }
*::-ms-backdrop, .myClass { myProperty: myValues }
}
It works fine for me ;)
If you need to target all non-ie (non <= ie11) browsers:
@media { @media {
/* Your styles ... */
}}
It will work for modern browsers only since IE <= 11 doesn't support nester media queries.