This is a solution to the Product preview card component challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
- View the optimal layout depending on their device's screen size
- See hover and focus states for interactive elements
- Semantic HTML5 markup
- CSS custom properties
- Flexbox
- CSS Grid
- Mobile-first workflow
This project I learned about using the Picture tag along with the Source tag to make the image responsive according to screen size. I also used the Mobile-First methodology for the first time
See how it looks below:
<picture>
<source media="(min-width: 770px)" srcset="./images/image-product-desktop.jpg">
<img src="./images/image-product-mobile.jpg" alt="image-product-mobile">
</picture>
/* Desktop */
@media (min-width: 770px) {
...
}
- Frontend Mentor - @smartinsdev
- Twitter - @smartinsdev