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
- Solution URL: https://www.frontendmentor.io/solutions/responsive-product-card-component-using-css-grid-and-flexbox-zFWNvEtM36
- Live Site URL: https://nesc11.github.io/product-preview-card-component/
- Semantic HTML5 markup
- CSS custom properties
- Flexbox
- CSS Grid
- Mobile-first workflow
- Media queries
The project helped me review basics concepts of responsive layout, some of the techniques I used:
- Media queries for larger screens starting from 768px to change the layout from single-column to two-column.
@media screen and (min-width: 48em) {
.card {
display: grid;
grid-template-columns: 1fr 1fr;
}
}
- Custom properties to easily reference the project's base styles.
:root {
/* Font family */
--ff-sans: "Montserrat", sans-serif;
--ff-serif: "Fraunces", serif;
/* Font sizes */
--fs-xs: 0.75rem;
}
Particularly I didn't learn anything new since I have applied this in other projects.