property

Image rendering — CSS reference

Hints how raster images should be scaled. Pixelated preserves hard pixel boundaries when scaled up to an integer multiple; it is useful for pixel art, not generally for photos. The image here scales two source pixels to 80 CSS pixels.

Formal Syntax & Structure

css syntaxcss
image-rendering: pixelated;

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>image-rendering</title><style>body{margin:8px;background:white;color:black;font:16px/20px sans-serif}*{box-sizing:content-box}#a{width:80px;height:40px;image-rendering:pixelated}</style><body><img id="a" alt="Two-color sample" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAABCAIAAAB7QOjdAAAAD0lEQVR4nGP4z8DAwPAfAAcAAf9+CLHQAAAAAElFTkSuQmCC"></body></html>
CSS Reference