跳过导航
How to make the Next Image always fit the parent container while staying fully visible
0:00 / 0:30

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

Alex Sidorenko

@asidorenko_3.5万 位关注者

在 X 上查看
900 个赞下载原帖

59,743 次观看

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

10 条评论

评论来自 X (Twitter) 上的原帖

  • Alex Sidorenko 的头像

    @asidorenko_

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

    62 个赞

  • Armo 的头像

    @Armo_MXT

    New syntax is fill="true"

    5 个赞

  • Nick 的头像

    @2SpaceMonkey3

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

    4 个赞

  • Trade Assistant AI 的头像

    @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 个赞

  • kehinde.code 的头像

    @thisKehinde

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

    1 个赞

  • Sam Selikoff 的头像

    @samselikoff

    he's back!!

    1 个赞

  • niftesty 🫐 的头像

    @niftesty

    Deprecated?

    1 个赞

  • kötü biri değilim ama 的头像

    @iiolmktnyoruldm

    i hate next image

  • Joan Laporta 的头像

    @JoanLaporta777

    You don’t write width and height?

  • will 的头像

    @consolelogwill

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