Last active
April 5, 2016 10:05
-
-
Save hsleonis/5c71c40ce5671e365d47 to your computer and use it in GitHub Desktop.
The image-rendering property defines how the browser should render an image if it is scaled up or down from its original dimensions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Chrome appears to render pixelated images in the same way that Firefox and Safari will render images with crisp-edges. | |
| Reference: | |
| https://css-tricks.com/almanac/properties/i/image-rendering | |
| https://developer.mozilla.org/en/docs/Web/CSS/image-rendering | |
| */ | |
| img { | |
| image-rendering: auto; | |
| image-rendering: crisp-edges; | |
| image-rendering: pixelated; | |
| /* Global values */ | |
| image-rendering: inherit; | |
| image-rendering: initial; | |
| image-rendering: unset; | |
| } | |
| img.cros-browser-best{ | |
| /* Webkit color separated image looks best with pixelated, but others look best with auto. */ | |
| image-rendering: pixelated; | |
| /* Opera */ | |
| image-rendering: -o-crisp-edges; | |
| /* Best on Firefox and Safari, put this on bottom, webkit will ignore. */ | |
| image-rendering: -moz-crisp-edges; | |
| image-rendering: crisp-edges; | |
| /* IE */ | |
| -ms-interpolation-mode: nearest-neighbor; | |
| } | |
| /* applies to GIF and PNG images; avoids blurry edges */ | |
| img[src$=".gif"], img[src$=".png"] { | |
| image-rendering: -moz-crisp-edges; /* Firefox */ | |
| image-rendering: -o-crisp-edges; /* Opera */ | |
| image-rendering: -webkit-optimize-contrast;/* Webkit (non-standard naming) */ | |
| image-rendering: crisp-edges; | |
| -ms-interpolation-mode: nearest-neighbor; /* IE (non-standard property) */ | |
| } | |
| .bicubic { | |
| -ms-interpolation-mode: bicubic; | |
| image-rendering: optimizeQuality; | |
| } | |
| .nearest { | |
| -ms-interpolation-mode: nearest-neighbor; | |
| image-rendering: optimizeSpeed; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment