This is a solution to the NFT 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 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.
Users should be able to:
- View the optimal layout depending on their device's screen size
- See hover states for interactive elements
- 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
- Flexbox
- CSS Grid
- Mobile-first workflow
- I learned an alternative method to stack two elements without using the
position: absolute
property. By leveraging the power ofdisplay: grid
, I was able to achieve this efficiently. - I explored creating a transparent overlay on an image. This effect, triggered on hover, adds a subtle and visually appealing touch to the design.
- I implemented a smooth transition effect on an element when interacting with its parent element. This enhances the overall user experience.
- Consider using
<span>
instead of paragraphs for elements that are not actual paragraphs. For example,<span>0.041 ETH</span>
and<span>3 days left</span>
- The illustration image is decorative, so its alt text must be empty:
alt=""
. - Profile image could benefit from a more descriptive alt text, like
alt="Headshot of Jules Wyvern"
.
-
use grid to stack up two items
.card-img-container { place-items: center; transition: opacity 0.25s; } .card-img-container img { grid-column: 1/-1; grid-row: 1/-1; }
-
transparent overlay on an image on hover
.card-img-container { border-radius: var(--border-radius-secondary); overflow: hidden; cursor: pointer; position: relative; } .card-img-container::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: hsla(178, 100%, 50%, 0.5); opacity: 0; transition: opacity 0.25s; } .card-img-container:hover::before { opacity: 1; }
-
apply a transition effect to an element when interacting to its parent element
.icon-view-svg { opacity: 0; } .card-img-container:hover .icon-view-svg { opacity: 1; }
- 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