Design comparison
SolutionDesign
Solution retrospective
I appreciate any feedback! I would also love to know how would you apply a cyan tint to the NFT image! Thank you :)
Community feedback
- @vanzasetiaPosted about 2 years ago
Hello, Edmond! 👋
Before I tell you how to create the overlay, we need to get the HTML right first.
- Don't use the
picture
element to wrap the Equilibrium image and the eye icon. It's not whatpicture
element suppose to be used. I recommend reading the MDN documentation for thepicture
element to know when to use it. - Remove the eye icon image from the HTML. We will create the overlay with pure CSS.
- Wrap the Equilibrium image with an anchor tag. It has interactivity so it should be wrapped by an interactive element. (the same goes for the
h1
and theauthor
) - The alternative text for the image should tell that it is also a link (like a call-to-action). So, since the hover effect will show an eye icon, we can assume that it will allow the user to preview the Equilibrium. So, the alternative text can be "Preview Equilibrium".
- You may notice that I remove the word "Image of". That's because there is no need for it. The semantic meaning of the
img
element is already enough.
Now, to create the overlay we use pseudo-element and
background
properties.- First, create a pseudo-element from the anchor tag.
- Make the pseudo-element fill the entire image.
- Lastly, on hover (
a:hover::before
), add the cyan background color and the eye icon. - For the cyan background color, use
hsla
(orrgba
) color format to control the opacity.
I hope this helps! Happy coding! 😄
0 - Don't use the
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