Skip to content

Instantly share code, notes, and snippets.

@bhalash
Last active December 2, 2015 11:35
Show Gist options
  • Save bhalash/6539ab4eab2547a30cb0 to your computer and use it in GitHub Desktop.
Save bhalash/6539ab4eab2547a30cb0 to your computer and use it in GitHub Desktop.
CSS media queries to target versions of Internet Explorer
/**
* Internet Explorer
* -----------------------------------------------------------------------------
* I am happy to exclude Internet Explorer 11 because it is decently good. My
* IE problems inecrease exponentially as I work backwards in time.
*
* @link http://keithclark.co.uk/articles/moving-ie-specific-css-into-media-blocks/
* @link http://keithclark.co.uk/articles/moving-ie-specific-css-into-media-blocks/media-tests/
* @link http://www.limecanvas.com/css-hacks-targeting-ie-10/
* @link http://www.paulirish.com/2009/browser-specific-css-hacks/
*/
@mixin ie($version: null) {
@if ($version) {
@if ($version == 6) {
$version: 'screen\9';
} @else if ($version == 7) {
$version: '\0screen\,screen\9';
} @else if ($version == 8) {
$version: '\0screen';
} @else if ($version == 9) {
$version: 'screen\0';
} @else if ($version == 10) {
$version: 'screen and (min-width:0\0)';
}
} @else {
// Target 8, 9 and 10 by default.
$version: 'screen\0';
}
@media #{$version} {
@content;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment