How to make the Next Image always fit the parent container while staying fully visible
Alex Sidorenko
在 X 上查看@asidorenko_3.5万 位关注者
59,743 次观看
How to make the Next Image always fit the parent container while staying fully visible
10 条评论
评论来自 X (Twitter) 上的原帖

@asidorenko_
Thanks for the heads-up! Here is the updated version
62 个赞

@Armo_MXT
New syntax is fill="true"
5 个赞

@2SpaceMonkey3
I'm pretty sure, the `objectFit` prop is deprecated. Instead, just add the object-fit css property
4 个赞

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

@thisKehinde
use objectFit in the inline-styles. it’s been deprecated as a props in next/image
1 个赞

@samselikoff
he's back!!
1 个赞

@niftesty
Deprecated?
1 个赞

@iiolmktnyoruldm
i hate next image

@JoanLaporta777
You don’t write width and height?

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