Hello @Luzefiru and congratulations for completing this challenge!
To answer your questions :
1. Your hover overlay method is fine! However I would change a few things :
- Switch the :before and :after to make the eye icon pass in front of the background. Or you could set
z-index: 1
to the :before.
- Try using a CSS transition to make the effect smoother. You could also set a transition to the title and author's name hover effects.
- Also, this is not about the hover effect but I wouldn't set the product image as a background. It's not a decorative image here, it would be good to make it accessible to screen readers by using an <img> tag and providing an alt attribute to describe it.
2. To make an absolute element take the full size of its parent, first make the parent's position relative
. An absolute element's position is calculated based on its closest relative
ancestor. Then you can make the element match its parent's boundaries like so :
.element {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
3. I wouldn't say it's a bad thing to use background-size: contain
, as long as the icon displays correctly. Here again I would have used an <img> tag but as it is a decorative icon, it's fine this way I guess. :)
4. I don't think you can change the colors of a SVG with CSS if you insert them as background image or even with an <img> tag. However you can do so by inserting the raw SVG inside your HTML, then you'd have access to the elements inside. But I really don't know if it's a good thing to do. Another way to do this is by converting your SVGs into a webfont. The icons can then be inserted as characters and you can change their color and size using CSS. This process is a bit complex though. For beginners, I'd say your method is really fine. :)
I hope my comment was helpful. You did a good job, keep going!