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.
Note: Delete this note and update the table of contents based on what sections you keep.
Users should be able to:
- View the optimal layout depending on their device's screen size
- See hover and focus states for interactive elements
- Git URL: GitHub URL
- Solution URL: Frontend Mentor URL
- Live Site URL: Vercel URL
- Semantic HTML5 markup
- CSS custom properties
- Mobile-first workflow
Learned how to set different images for different screen type with HTML and manipulate how the card looks like differently on desktop and mobile with CSS
srcset
defines the set of images we will allow the browser to choose between, and what size each image is. Each set of image information is separated from the previous one by a comma.
HTML
<img
srcset="images/image-product-desktop.jpg 600w,
images/image-product-mobile.jpg 686w"
sizes="(max-width: 600px) 686px, 300px"
src="images/image-product-desktop.jpg"
alt="A bottle of perfume surrounded by foliage"
/>
CSS
@media only screen and (max-width: 600px) {}
To enhance more on using flexbox and learn other different ways to showcase product details in desktop/mobile view
- Flexbox -- Helped me to use flexbox
- Responsive Images in HTML -- Helped me to make images responsive (Improve UI/UX for desktop and mobile)
- Media conditions in CSS for different viewport -- Helped to make images responsive depending on device type
- Frontend Mentor - @sharonlhs
- LinkedIN - @sharonlhs
- Twitter - @sharonlhs