Don’t use CSS dvh for images

Saurav
Nov 28, 2023

--

CSS’ new dvh (dynamic viewport height) unit has an issue with images. If you scale an image using dvh it tends to have a snapping motion when the browser switches between svh (smallest vh) and lvh (largest vh).

Watch the video below.

However, dvh can be used for a other DOM elements such as a div since the snapping motion won’t be so apparent on a container with a solid color.

--

--

Saurav
Saurav

No responses yet