Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

NFT preview card component with interactive hover elements

kenzo-wegherβ€’ 60

@kenzo-wegher

Desktop design screenshot for the NFT preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

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

Ferβ€’ 3,970

@fernandolapaz

Posted

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 of place-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 helpful

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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