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.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Saurav
Saurav

No responses yet

Write a response