Skip to content

Instantly share code, notes, and snippets.

@Shilo
Forked from tombennet/preserve-pixelation.scss
Created December 23, 2019 09:13
Show Gist options
  • Save Shilo/ac0adb6ca427b61d737fd25c77e6c853 to your computer and use it in GitHub Desktop.
Save Shilo/ac0adb6ca427b61d737fd25c77e6c853 to your computer and use it in GitHub Desktop.
Preserve pixelation when scaling pixel art with CSS - https://builtvisible.com/image-scaling-in-css/
@mixin pixelated {
-ms-interpolation-mode: nearest-neighbor; // IE 7+ (non-standard property)
image-rendering: -webkit-optimize-contrast; // Safari 6, UC Browser 9.9
image-rendering: -webkit-crisp-edges; // Safari 7+
image-rendering: -moz-crisp-edges; // Firefox 3.6+
image-rendering: -o-crisp-edges; // Opera 12
image-rendering: pixelated; // Chrome 41+ and Opera 26+
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment