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.
Users should be able to:
- View the optimal layout depending on their device's screen size
- See hover states for interactive elements
- Solution URL: Frontend Mentor
- Live Site URL: Github Pages
- Semantic HTML5 markup
- CSS custom properties (variables)
- Flexbox
- CSS Grid
- Mobile-first workflow
I learned how to use the after pseudo-element to add the icon view image in CSS only.
.nft-banner::after {
--accent-clr-alt: hsla(178, 100%, 50%, 0.5);
content: url("../images/icon-view.svg");
position: absolute;
inset: 0;
background-color: var(--accent-clr-alt);
display: flex;
justify-content: center;
align-items: center;
opacity: 0;
transition: opacity var(--transition);
}
- Nested border radius - This article helped me with applying the border radius on the image.
I used this Youtube nft preview card component video tutorial.