NFT preview card component with interactive hover elements
Design comparison
Solution retrospective
I've tried to get as close as I could to the get the same effect on the nft-image:hover, but I couldn't get the same level of brightness of the eye-image's white.
If anyone has any suggestions on how can I solve that problem or, in any case, how can I possibly improve and/or reduce unnecessary code is welcome!
Thanks in advance. Grazie mille!
Community feedback
- @fernandolapazPosted over 1 year ago
Hi π, perhaps some of this may interest you:
HTML π§±:
- When there is a hover state over an element it means that it is interactive, so there must be an interactive element around it (like a link or a button). So, we should use a
<a>
or<button>
to wrap the image (depending on what happened when clicking on it). Also 'Equilibrium #3429' and 'Jules Wyvern' should be wrapped with the<a>
tag.
CSS π¨:
- Be very careful with changing the
font-size
of the root element (html
) to 10px, I would say that it is not recommended at all, for accessibility reasons.
- If you want to center the content you should use
place-content
instead ofplace-items
.
- Regarding de hover effect:
I leave you another way to do it in case you want to take a look: You can use the ::before pseudo-element to insert content (background and icon in this case) to an element (the image).
.img-box { position: relative; } .img-box::before { position: absolute; content: url(images/icon-view.svg); display: grid; place-content: center; background-color: hsla(178, 100%, 50%, 0.5); width: 100%; height: 100%; opacity: 0; } .img-box:hover::before { opacity: 1; }
Please let me know if you want more info on any of these topics or disagree with something. I hope itβs useful π
Regards,
Marked as helpful0 - When there is a hover state over an element it means that it is interactive, so there must be an interactive element around it (like a link or a button). So, we should use a
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