Responsive product card component

Solution retrospective
I'm most proud of implementing a fully responsive design using the <picture> element and mobile-first approach. The way I handled different image versions for mobile and desktop screens worked really well.
For next time, I would:
- Add more interactive animations to the button
- Use CSS Grid alongside Flexbox for more complex layouts
- Write more organized CSS using BEM naming
My main challenges were:
-
Image Responsiveness
- Problem: Making images look good on both mobile and desktop
- Solution: Learned about the <picture> element and used different image files for each screen size
-
Consistent Sizing
- Problem: Getting consistent measurements across the design
- Solution: Used rem units with html { font-size: 62.5% } to make calculations easier
-
Button Styling
- Problem: Making the button match the design exactly
- Solution: Used CSS custom properties for colors and added proper hover/active states
I would appreciate feedback on:
-
CSS Organization
- Is my CSS structure clean and maintainable?
- How can I better organize my custom properties?
-
Accessibility
- Are my HTML elements semantic enough?
- How can I improve keyboard navigation?
-
Performance
- Are there better ways to handle the responsive images?
- Could my CSS be more optimized?
Please log in to post a comment
Log in with GitHubCommunity feedback
- @dar-ju
Hi, Udara Lakshitha!
Great solution for the first work in FM!
Semantics are correct.
I could add about CSS - just don't use
.price .old-price{
nesting, you already have the .old-price class, use.old-price{
Keyboard accessibility is not important here, there is only one active element here, this is a button and focus on it works.
For background and decorative images, leave alt empty, in the example with the basket icon, search engines and readers do not need this information, just do alt=""
Otherwise everything is great, keep it up!
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