Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

NFT Preview Card Component built with HTML, CSS and a bit of JS

Zascu 140

@ZascuOfficial

Desktop design screenshot for the NFT preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Hello, all! This is my solution to the NFT Preview Card Component challenge.

The only question I have this time around is this: Was there any other way to make the eye icon appear on the preview image while hovering without using JavaScript?

Thank you, if anyone decides to respond. Have an amazing day!

Community feedback

P
visualdennis 8,375

@visualdenniss

Posted

Hey there,

nice work. To answer your questions: In fact, this challenge is expected to be solved by only HTML and CSS (see the tags in challenge page as well), so it does not require any JS at all. To make the overlay appear, all you need is position absolute/position relative in combination with hover changes. Here is an example from my own solution just to give you an idea:

.nftCard-img-container { position: relative; }

.nftCard-view-icon-container { position: absolute; top: 0; left: 0; height: calc(100% - 5px); width: 100%; display: flex; justify-content: center; align-items: center; background-color: hsla(178, 100%, 50%, 0.29); border-radius: 15px; opacity: 0; transition: all 0.4s ease-in-out; cursor: pointer; }

.nftCard-img-container:hover .nftCard-view-icon-container { opacity: 1; }

Hope you find this feedback helpful!

Marked as helpful

1

Zascu 140

@ZascuOfficial

Posted

@visualdenniss Oh my goodness me!

You're totally right! I could have used the opacity trick now that I think about it. This is really helpful, thank you so much! I am changing it right away.

Again, I appreciate it!

1
P
visualdennis 8,375

@visualdenniss

Posted

@ZascuOfficial Glad to hear it helped! Good luck on the next challenges!

1

Please log in to post a comment

Log in with GitHub
Discord logo

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