Responsive product card component using HTML & CSS

Solution retrospective
I'm most proud of successfully implementing responsive images using the <picture>
element to serve different images at different breakpoints. This was particularly satisfying because I tackled the challenge of having a wider mobile image (686px) than desktop image (600px), which made traditional srcset
approaches less reliable.
Next time, I would start with a more semantic HTML structure from the beginning. I had to restructure elements later to improve accessibility and semantic meaning, which would have been easier to implement from the start.
What challenges did you encounter, and how did you overcome them?The main challenge was controlling which image version displayed at different breakpoints, especially since my mobile image was unexpectedly wider than my desktop image. The srcset
and sizes
attributes weren't behaving as expected.
I overcame this by:
- Learning about the
<picture>
element which allowed explicit control through media queries - Using DevTools to inspect the behavior at different breakpoints
- Seeking assistance to understand why my original approach wasn't working
Another challenge was getting equal-width columns in the desktop layout, which I resolved by applying width: 50%
to ensure consistent rendering.
I'd appreciate guidance on:
- Typography scaling - my use of
clamp()
for responsive font sizing led to compounding effects with my CSS custom properties - Best practices for SVG implementation - particularly controlling color and size efficiently
- More accessible markup patterns for product cards - ensuring my component follows best practices for screen readers and keyboard navigation
Please log in to post a comment
Log in with GitHubCommunity feedback
- @DeveshSoni973
That is one fine site, I mean almost perfect imo, one thing tho, I saw that on my pc, I had to use the scrollbar to get to the bottom of the webui, and that some portion of the webpage, I gotta scroll. I do not think it was intended. Maybe adjusting the elements wrt the max-width from the window? (get it dynamically from browser :)))
Marked as helpful
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