Design comparison
Solution retrospective
I had some trouble finding out how to do an overlay effect on hover but I found a solution. Is this the right way to do it or is there a better way for it?
Thank you!
Community feedback
- @dostonnabotovPosted over 2 years ago
Hi, there. You can add an eye icon and background-color, using pseudo-elements. For example, in
.card::before
, you addbackground-color
, and in.card::after
, you add your icon asbackground-image
. You have to make sure that both are set theiropacity
to 0. When hovered, in.card:hover::before
and.card:hover::after
, you addopacity
to make it visible. You can view my solution as well if you want where I used this strategy.Marked as helpful1@MariusHorPosted over 2 years ago@dostonnabotov I appreciate your feedback. It was really helpful, making me aware of needing to use pseudo-elements. I ended up using what you have suggested together with some other codes as well and it worked perfectly. I managed to turn the image into a link as well so this was great!
0
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