Loading video...

Video Failed to Load

Go Home

How to make the Next Image always fit the parent container while staying fully visible

59,743 views • 2 years ago •via X (Twitter)

10 Comments

Alex Sidorenko's profile picture
Alex Sidorenko2 years ago

Thanks for the heads-up! Here is the updated version

Armo's profile picture
Armo2 years ago

New syntax is fill="true"

Nick's profile picture
Nick2 years ago

I'm pretty sure, the `objectFit` prop is deprecated. Instead, just add the object-fit css property

Trade Assistant AI's profile picture
Trade Assistant AI2 years ago

Looks like a classic CSS challenge, just set the image to max-width 100% and height auto for that perfect fit

kehinde.code's profile picture
kehinde.code2 years ago

use objectFit in the inline-styles. it’s been deprecated as a props in next/image

Sam Selikoff's profile picture
Sam Selikoff2 years ago

he's back!!

niftesty 🫐's profile picture
niftesty 🫐2 years ago

Deprecated?

kötü biri değilim ama's profile picture
kötü biri değilim ama2 years ago

i hate next image

Joan Laporta's profile picture
Joan Laporta2 years ago

You don’t write width and height?

will's profile picture
will2 years ago

Do you know of an easy way to do a dynamic gradient on the edges that uses colors from the image?

Related Videos