Skip to content

Instantly share code, notes, and snippets.

@tcrammond
Last active October 2, 2020 13:50
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save tcrammond/99fd936007685dba97b7 to your computer and use it in GitHub Desktop.
Save tcrammond/99fd936007685dba97b7 to your computer and use it in GitHub Desktop.
A sass mixin to write css that targets only IE 10 and IE 11
// Thanks http://philipnewcomer.net/2014/04/target-internet-explorer-10-11-css/
/*
Usage:
@include target-metro {
color: cyan;
}
*/
@mixin target-metro {
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
@content;
}
}
@azzimuth
Copy link

How do I do opposite? A mixin for browsers except IE11?

@riseoflex88
Copy link

riseoflex88 commented Jul 30, 2018

@azzimuth Usually it's just best to target everything, then use the mixin above to remove the single case e.g.

body {
  background: red;
  @include target-metro {
    background: green;
  }
}

@holylander
Copy link

nice method thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment