Product Preview Card Component 🎯. ( BEM + Responsive Images )
Design comparison
Solution retrospective
Hello, Frontend Mentor community 🙋♂️.
This is my solution ✅ for the Product Preview Card Component
I learned about Responsive Images 🖼, picture
tag in HTML, It was also a good project to practice Flexbox📦.
It was really easy to make it responsive thanks to flexbox. It really is a powerful tool.
Follow me in my journey to finish all Free 🆓 and Free + challenges (62 left 🎯)! Gotta Catch ’Em All
That's all.
Have Fun Coding!
Community feedback
- @danielmrz-devPosted 9 months ago
Hello @rahulkumar215! 🙋🏽♂️
Your solution looks excellent!
I have a suggestion that might interest you:
📌 If you don't have the Figma design files, I recommend using a browser extension called Perfect Pixel.
It allows you to compare your finished project with the design images that come along when you download the project and check the (almost exact) dimensions. It's very useful!
I hope it helps you in future projects! 😊
Other than that, great job!
Marked as helpful0@rahulkumar215Posted 9 months agoHello @danielmrz-dev,
I was wondering the same thing about how can I get the solution to look exactly like the design.
Thank you so much!
1 - @Alil0lPosted 9 months ago
This is such great work!
I loved the picture in the README file I'd love to try it too.
I wanted to ask, why you used before and after for * element 🤔
I'm still new and would love to learn more 😁
0@rahulkumar215Posted 9 months agoHello @Alil0l ,
Thanks for checking out my solution.
The reason to use
::before
and::after
for*
element is that when you define a::before
and::after
element orpseudo classes
, then it help with their positioning with setting theirmargin
andpadding
to 0, andbox-sizing
toborder-box
.Overall it is a best practice in CSS to do so.
Commonly you will see,
*{ margin: 0; padding: 0; box-sizing: border-box; }
from the start the browser applies some default margins and padding to HTML elements, We use this base style to reset that style.
Check out more here :-
-Why do we set the base style?
That is everything, If you have more questions, feel free to ask. I will be more than happy to help 😃
Have Fun Coding!
1
Please log in to post a comment
Log in with GitHubJoin 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