Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

image-rendering — CSS property

`image-rendering` controls the pixel scaling algorithm of a replaced image.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

auto | crisp-edges | pixelated | smooth

image-rendering controls the pixel scaling algorithm of a replaced image.

The example applies the property to a real img element and reports its natural size, element box, and computed value.

The accepted grammar is auto | crisp-edges | pixelated | smooth; global values still participate in the cascade.

This is an image-rendering stage: it does not resize the element box, and metadata orientation depends on the source data.

Examples

<!doctype html>
<html lang="en"><meta charset="utf-8"><title>CKTIS CSS reference example</title>
<body><div class="probe">probe</div><pre id="result"></pre><script>
document.body.innerHTML='<img id="x" alt="" width="40" height="20"><pre id="result"></pre>';const x=document.querySelector("#x");x.style.setProperty("image-rendering","pixelated");document.querySelector("#result").textContent="element="+x.localName+"; box="+Math.round(x.getBoundingClientRect().width)+"x"+Math.round(x.getBoundingClientRect().height)+"; computed="+getComputedStyle(x).getPropertyValue("image-rendering").trim();
</script></body></html>

Result

element=img; box=40x20; computed=pixelated

The example was executed locally in an isolated, network-free Chrome session; the result comes from the browser CSS API.

Sources