Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mayen007/product-preview-card-component
A responsive product preview card component solution for the Frontend Mentor challenge. Built using HTML, CSS, and responsive images, this project features a clean and minimal design. It includes mobile-first styling, custom fonts with @font-face, hover effects, and media queries for an optimal user experience on different devices.
https://github.com/mayen007/product-preview-card-component
beginner beginner-code beginner-friendly card css-flexbox html-css media-queries
Last synced: 12 days ago
JSON representation
A responsive product preview card component solution for the Frontend Mentor challenge. Built using HTML, CSS, and responsive images, this project features a clean and minimal design. It includes mobile-first styling, custom fonts with @font-face, hover effects, and media queries for an optimal user experience on different devices.
- Host: GitHub
- URL: https://github.com/mayen007/product-preview-card-component
- Owner: Mayen007
- License: mit
- Created: 2024-11-13T17:52:20.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-12-11T14:52:49.000Z (23 days ago)
- Last Synced: 2024-12-11T15:46:52.512Z (23 days ago)
- Topics: beginner, beginner-code, beginner-friendly, card, css-flexbox, html-css, media-queries
- Language: CSS
- Homepage: https://mayen007.github.io/product-preview-card-component/
- Size: 9.58 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Frontend Mentor - Product Preview Card Component Solution
This is my solution to the [Product Preview Card Component challenge on Frontend Mentor](https://www.frontendmentor.io/challenges/product-preview-card-component-GO7UmttRfa). This project was a great opportunity to enhance my skills in responsive design using HTML and CSS, focusing on creating a clean, elegant product preview card.
## Table of contents
- [Overview](#overview)
- [The challenge](#the-challenge)
- [Screenshots](#screenshots)
- [Links](#links)
- [My process](#my-process)
- [Built with](#built-with)
- [What I learned](#what-i-learned)
- [Continued development](#continued-development)
- [Useful resources](#useful-resources)
- [Author](#author)
- [Acknowledgments](#acknowledgments)## Overview
### The challenge
Users should be able to:
- View the optimal layout for the product card depending on their device's screen size (mobile or desktop)
- See hover and focus states for the "Add to Cart" button### Screenshots
#### Desktop View
![Desktop View](./assets/images/desktop-view.png)
#### Mobile View
![Mobile View](./assets/images/mobile-view.png)
### Links
- [Solution URL](https://github.com/Mayen007/product-preview-card)
- [Live Site URL](https://mayen007.github.io/product-preview-card)## My process
### Built with
- **Semantic HTML5** for better structure
- **CSS Custom Properties** for maintainable and reusable styling
- **Flexbox** for flexible and responsive layout control
- **Responsive Images** to provide optimal visuals for both mobile and desktop views
- **Mobile-first workflow** to ensure a great user experience on smaller screens### What I learned
Here are some key learnings from this project:
1. **Font Management with @font-face**:
- I implemented custom fonts using `@font-face` for a consistent and unique typography style throughout the component.
```css
@font-face {
font-family: "Fraunces-Italic";
src: url("./assets/fonts/Fraunces/static/Fraunces_144pt_Soft-Black.ttf")
format("truetype");
font-weight: 700;
font-style: normal;
}
```
2. **Responsive Design Using Media Queries**:- I used media queries to switch between mobile and desktop layouts. The images are swapped using CSS based on the viewport size.
```css
@media (max-width: 768px) {
.desktop-image {
display: none;
}
.mobile-image {
display: block;
}
}@media (min-width: 768px) {
.desktop-image {
display: block;
}
.mobile-image {
display: none;
}
}
```3. **Button Hover Effects**:
- I applied a smooth transition effect to the "Add to Cart" button for a better user interaction experience.
```css
.card-button:hover {
background-color: var(--dark-cyan-hover);
}
```### Continued development
Moving forward, I plan to:
- Experiment more with **CSS Grid** for complex layouts
- Enhance my understanding of responsive design techniques like **fluid typography**
- Explore **JavaScript** for adding dynamic interactivity to similar projects### Useful resources
- [MDN Web Docs - @font-face](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face) - This helped me understand how to implement custom fonts effectively.
- [CSS Tricks - Media Queries](https://css-tricks.com/css-media-queries/) - A great guide for understanding and utilizing media queries for responsive design.## Author
- **GitHub** - [Mayen007](https://github.com/Mayen007)
- **Frontend Mentor** - [@Mayen007](https://www.frontendmentor.io/profile/Mayen007)## Acknowledgments
Thanks to **Frontend Mentor** for providing this challenge, which helped me solidify my understanding of responsive design and CSS techniques.