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.
Your challenge is to build out this product preview card component and get it looking as close to the design as possible.
You can use any tools you like to help you complete the challenge. So if you've got something you'd like to practice, feel free to give it a go.
Your users should be able to:
- View the optimal layout depending on their device's screen size
- See hover and focus states for interactive elements
Want some support on the challenge? Join our Slack community and ask questions in the #help channel.
- Solution URL: click here to see the solution
- Live Site URL: click here to see the Live Site
- codepen: click here to see the codepen
- Semantic HTML5 markup
- CSS custom properties
- CSS Grid
- CSS Flex
-
<picture> Tag:
- Discovered and utilized the <picture> tag in HTML, a powerful tool for responsive image handling.
- Learned how to interchange image files based on specific screen sizes using the
srcset
attribute.
-
ARIA Attributes:
- Implemented ARIA attributes, such as
aria-label
, to enhance accessibility in web development.
- Implemented ARIA attributes, such as
-
Grid Layout:
- Utilized the CSS Grid layout extensively for a project.
- Explored less common grid properties, including the use of
auto
to dynamically allocate space based on content.
-
ARIA attributes
<p class="price" data-item-type="strong" aria-label="Price: $149.99">$149.99</p>
-
Picture and source tag:
<picture> <source media="(max-width: 599px)" srcset="images/image-product-mobile.jpg"> <source media="(min-width: 600px)" srcset="images/image-product-desktop.jpg"> <img class="product-image" src="images/image-product-desktop.jpg" alt="Gabrielle Essence Eau De Parfum image"> </picture>
-
use of
auto
in grid:.price-container { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: center; }
- Display Different Images Based on Device Width with #Picture and #Source Tags
- ARIA HTML Tutorial - What is ARIA & Why it's Important to Use!
- Website - Ranit Manik
- Frontend Mentor - @RanitManik
- LinkedIn - @ranit-manik
I would like to express my gratitude to the creators of the Frontend Mentor platform for providing an engaging and practical challenge in the form of the Blog Preview Card. The hands-on experience gained through tackling this project has significantly contributed to my growth as a web developer.
I want to acknowledge the supportive community at Frontend Mentor. The platform's collaborative environment and constructive feedback from peers have been invaluable in refining my skills and pushing me to strive for excellence.
This project has been a rewarding learning experience, and I look forward to applying these insights in future endeavors. Thank you to everyone who has played a part in my journey of continuous improvement.
Best regards,
Ranit Manik