Best way to align captions with varying width images?
I've got a layout where I want the captions to always be aligned with the left edge of the images, which can vary in orientation and aspect ratio. What's the best markup and css to achieve this? I've tried setting the parent container of the image and caption as a flex box set to width fit-content but it's buggy and causing other issues so I'm wondering if there's a nicer way that my brain can't figure out. Ideally the captions will align horizontally but I'm willing to sacrifice that in order to get vertical alignment with the images correct.
Recent Announcements
Continue the conversation
Join the Discord to ask follow-up questions and connect with the community
KP-C
Kevin Powell - Community
A friendly place for developers to meet other devs, ask questions, get help, and just have a good time 🙂.