Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 2 years ago

NFT Card: Flexbox mastery and hover trickeries!

moi21dev•50
@moi21dev
A solution to the NFT preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hey all,

I have really enjoyed this challenge, it's my favorite one so far! I feel that I've finally got to understand how Flexbox works, thanks to the suggestions kindly provided by @zsoltvarju in my previous challenge.

  • Question:

I've managed to make the image overlay in CSS, but it was quite challenging! I would appreciate feedbacks and technical advice.

The code related to the overlay in index.html is in class="pictures" div. In CSS please review the following lines:

/* nft and overlay images container */
.pictures {
position: relative;
}

/* nft image */
.parent-img {
display: block;
width: 100%;
height: 300px;
margin-top: 20px;
border-radius: 10px;
position: relative;
}

/* overlay container */
.overlay {
position: absolute;
top: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-radius: 15px;
width: 100%;
overflow: hidden;
}

.overlay img {
opacity: 0;
}

/* hover over nft card image */
.pictures:hover img{
opacity: 1;
transition: 0.3s ease-in-out;
}

.overlay:hover {
cursor: pointer;
background-color: hsla(178, 100%, 50%, 0.6);
}
Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on moi21dev's solution.

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner
  • Use cases

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License