@BenjaDotMin
Posted
Hello Adina! First off, great work with this, I think you have handled the spacing very well. Looking great.
Regarding your question, here is how I would handle the eye hover.
- Delete ".viewicon" img tag inside ".overlay"
- Delete the ".viewicon" css
- Change opacity:0.5 on ".containerimage:hover .overlay", to opacity:1
- On your ".overlay" class, add: background: url(./images/icon-view.svg) no-repeat center rgb(0 255 247 / 50%);
This should centre the eye, but also give you a transparent background. Apologies, I do not know what the exact colours are from the design, so I just guessed. You may be able to get it closer.
The issue you were having is due to that opacity is inherited by all children, whereas rgba is not inherited by children.
Also I notice on your ".overlay" class, you have: transform: 0.3s ease; This should be: transition: 0.3s ease; That should get your animation working.
This is all I have, but again good job!
Marked as helpful
@adinabbb
Posted
@BenjaDotMin
Hey Benja! While your solution didn't really give me the wanted end result to have only the icon on opacity 1 and the background overlay to opacity 0.5 I actually took a very good tip from you which is deleting the icon part from my html and writing it in the css file for a cleaner code.
Thank you!!
@BenjaDotMin
Posted
@adinabbb My pleasure! Apologies, I must have misread what you wanted to achieve. But I am glad you got a take-away :)
It can be really nice to use background images, especially if you want to re-use an image many times or easily centre images, plus saving any extra lines of code. But just be wary, there is no alt for background images, so it depends on what support you need for screen readers etc.
Happy to help, and keep up the impressive work!
Marked as helpful