Responsive Product Preview Card

Solution retrospective
During this project, I focused on implementing a clean component structure using BEM methodology in SCSS. I organized my styles modularly by separating the reset, variables, and utility classes into their own files.
I'm particularly proud of my responsive image handling, which switches between desktop and mobile versions based on screen size:
<picture className="product-card__image"> <source srcset="{DesktopProduct}" media="(min-width: 40rem)" /> <img src="{MobileProduct}" alt="Product" /> </picture>
The BEM methodology helped me create maintainable CSS with clear parent-child relationships:
What challenges did you encounter, and how did you overcome them?.product-card { &__content { // Content styles } &__button { // Button styles &:hover { // Hover state } } }
Learning proper BEM methodology with nested CSS variables in SCSS. The documentation for SCSS is not well laid out. I ended up using Ai to help me parse through the documentation and understand how to setup the file structure and learn the best practices. Overall, a fun little practice project. I'm not sure if I like SCSS or TailwindCSS better.
What specific areas of your project would you like help with?In future projects, I'd like to further explore:
- TypeScript integration for component props
- Creating more reusable components
- Implementing better accessibility practices
- Exploring animation and microinteractions
Please log in to post a comment
Log in with GitHubCommunity feedback
- @MarziaJalili
Fantasticoo! 💯
A tiny tweak?
✅ Consider adding some padding to the page (rhymes very well 😅) for the mobile to sharpen the beauty of the web even more.
✅ Example:
body { padding: 4rem 2rem; }
Other than that, the web looks great!
😎😎😎
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