Next.js Discord

Discord Forum

How to make images responsive? next/image

Unanswered
Naeemgg posted this in #help-forum
Open in Discord
we have to pass length and width then how can we make it responsive??
tried passing sizes & layout={'responsive'}

2 Replies

The width and height are to infer the correct aspect ratio of the image and avoid layout shift during loading, you can still use tailwind setting a className = "flex" or any class that you want
Siberian
I'm having a related issue. Using fill and sizes with Next 15 and next/image. The srcset is getting populated with multiple image versions (links to the image API), but all of them link to the original image.

Please see this issue for more details:
https://github.com/vercel/next.js/issues/65890#issuecomment-2466570522