Design comparison
SolutionDesign
Solution retrospective
It seems like everything is fine, but I had a hard time giving the hover eye feature to my picture and I gave up, I'm not good at those things, I need to go on
šš
Community feedback
- @milley69Posted almost 2 years ago
Hi, next time don't give up, it's better to sit once again, but find a way :) In short, I have slightly supplemented your code for an example so that you can figure it out a little. I understand that there is most likely a better version of this hover effect, but still...
HTML
<div class="nft-main-img"> <a href="#"><img class="main-img" src="./images/image-equilibrium.jpg" alt="New's Nft Equilibrium Image"/></a> </div>
CSS
.nft-main-img a { position: relative; } .nft-main-img a::after{ content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: var(--cyan); opacity: 0; transition: opacity .3s ease; } .nft-main-img a::before{ content: url("images/icon-view.svg"); position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); z-index: 1; opacity: 0; transition: opacity .3s ease; } .nft-main-img a:hover::after{ opacity: .3; } .nft-main-img a:hover::before{ opacity: 1; }
Good luck to you
Marked as helpful1
Please log in to post a comment
Log in with GitHubJoin 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