#Next/Image Sizing

4 messages · Page 1 of 1 (latest)

foggy olive
#

I have a set of images of various aspect ratios. I want each image to fit its parent container's width, and its height to fit the original aspect ratio of the image. How do I do this with CSS and next/image?

low wrenBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

      🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in <id:customize>

      ✅ You can mark a message as the answer for your post with `Right click -> Apps -> Mark Solution`
      (if you don't see the option, try refreshing Discord with Ctrl + R)
foggy olive
#

I'm pretty sure I would just use height: auto if it were a normal relative img element but that doesn't seem to work

foggy olive
#

nvm just figured it out after like 40 mins of troubleshooting, posting the solution here for future reference