Design comparison
SolutionDesign
Solution retrospective
How to make the eye icon visible while hovering over the image? How to make it responsive for smaller devices?
Community feedback
- @byronbyronPosted over 2 years ago
Hi @ujwalvinay
You can put the overlay hover on the image by adding an image wrapper and using a pseudo element, something like:
<div class="img-wrapper"> <img src="images/image-equilibrium.jpg" alt="image" id="banner"> </div>
.img-wrapper { position: relative; } .img-wrapper::before { content: ''; background: url('../images/icon-view.svg') center no-repeat hsla(178, 100%, 50%, 0.5); display: block; border-radius: 1.2rem; position: absolute; top: 0; right: 5%; bottom: 0; left: 5%; z-index: 100; visibility: hidden; opacity: 0; transition: visibility 0.3s, opacity 0.3s; } .img-wrapper:hover::before { visibility: visible; opacity: 1; }
Hope that helps! 👍
Marked as helpful2
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