Skip to content

Instantly share code, notes, and snippets.

@pinoceniccola
Last active January 7, 2016 12:50
Show Gist options
  • Save pinoceniccola/ecdb2e9a2d21927adc06 to your computer and use it in GitHub Desktop.
Save pinoceniccola/ecdb2e9a2d21927adc06 to your computer and use it in GitHub Desktop.
Fun with Image-rendering
<div>
<img src="https://unsplash.it/20/8/?image=851" class="pixelated">
<img src="https://unsplash.it/780/300/?image=851" class="bilinear">
</div>
/*
experimenting with CSS image-rendering for a project.
pixelated image is actually 20x8px
*/
div {
position:relative;
}
img {
width:100%;
height:auto
}
.pixelated {
image-rendering:-moz-crisp-edges;
image-rendering:pixelated;
-ms-interpolation-mode: nearest-neighbor;
}
.bilinear {
opacity:0;
position:absolute;
top:0;
left:0;
transition:opacity 0.25s ease 0s;
}
div:hover .bilinear {
opacity:0.6;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment