Menu

1 / 2

Why a CSS rotate with will-change: transform makes images and text blurry

DEV Community: css·Mohamed Gado·about 23 hours ago
#1o2Ie5he
#devtocss#devto#dev#transform#pixels
Reading 0:00
15s threshold

If an element is rotated or scaled and has will-change: transform , the browser can rasterise it once and then resample that bitmap every time it moves. Text and thin UI edges come out soft, and no amount of image quality fixes it. On my site, app screenshots looked pixelated because every card had a 0.9deg rotation under will-change: transform and a hover scale. Removing the tilt, the scale and the will-change made them sharp.

The report that started this was short: the images on the Masareef, Rafiq and Nafis project pages looked pixelated and bad. The files on disk were fine. Every screenshot was 1200px wide and sharp. The browser was blurring them on the way to the screen.

Why does will-change: transform make things blurry?

will-change: transform tells the browser to promote the element to its own compositor layer. That layer is drawn into a bitmap, and from then on the compositor moves, rotates and scales the bitmap on the GPU without repainting the content.

That is fast, and it is also the problem.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.