Responsive Product Preview Card using and CSS Flexbox

Solution retrospective
I'm most proud of implementing responsive art direction using the <picture> element to swap between the mobile and desktop product images seamlessly, as well as combining Flexbox with overflow: hidden so the image clips cleanly to the card's rounded corners.
Next time, I would adopt a stricter mobile-first CSS workflow using min-width media queries in em units right from the start, and double-check all relative asset paths (./images/...) before deploying to GitHub Pages.
One challenge I encountered was ensuring the product images loaded properly after deploying to GitHub Pages, as root-relative paths (/images/...) worked locally on Live Server but broke in the hosted repository subpath. I fixed this by switching all src and srcset paths to explicit relative paths (./images/...).
Another challenge was keeping the card image aligned and neatly cropped across desktop and mobile transitions, which I solved using object-fit: cover alongside overflow: hidden on the main .card container.
I'd love feedback on my semantic HTML structure (especially my use of the <picture> element) and whether my responsive Flexbox layout transitions cleanly across different screen sizes and zoom levels. Any tips on improving keyboard accessibility or CSS organization are also very welcome!
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Lueslin’s solution.
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord