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

πŸ’° Responsive NFT Card Preview πŸ’°

Shivβ€’ 350

@undrthegraveyard

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


What are you most proud of, and what would you do differently next time?

Turned out quite well, so happy happy! 😊

What challenges did you encounter, and how did you overcome them?

While adding a hover interaction in the hero image of that neon background color and view icon. I took the help of my custom GPT. ✌🏻

What specific areas of your project would you like help with?

Just one very specific part:

In styles.css, there is a particular section of .nft__overlay, along with its hover interaction code.

I would love to hear your thoughts on how that interaction could have been implemented more efficiently. πŸ˜ƒ

Community feedback

imadβ€’ 3,330

@imadvv

Posted

greeting Shiv,

There are many ways to implement the hover effect. Your implementation works, but from an accessibility standpoint, there are some notes and improvements that can make it better.

Currently, the overlay is a focusable element while the div element is not!. "You can make it, of course, but it will require adding some specific data attributes." The more stand-fore way to improve this, is by changing the div to either a link (a) or a button. This will allow users to interact with the NFT in its active state.

For the nft__overlay class, you can take advantage of CSS pseudo-classes to implement the view icon, as it is just a decorative icon and does not need to be included in the HTML structure. I made some changes to the nft__overlay to demonstrate this:

html line 25

           <!-- <img src="images/icon-view.svg" alt="View icon" class="view-icon"/> -->

css

.nft__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: hsla(178, 100%, 50%, 0);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: 0.3s ease-in-out;
}

.nft__overlay::after {
    content: url(./images/icon-view.svg);
    opacity: 0;
    transition: opacity 200ms ease-in-out;
}

/* Hover Interation */
.nft__overlay:hover,
.nft__overlay:focus {
    background-color: hsla(178, 100%, 50%, 0.5);
}

.nft__overlay:hover::after,
.nft__overlay:focus::after {
    opacity: 1;
}

These changes will make your overlay more accessible and maintain a clean HTML structure.

Hope this give you some hints , Keep up the good work!

Marked as helpful

1

Shivβ€’ 350

@undrthegraveyard

Posted

Hey @imadvv,

Thank you so much for such well-articulated and detailed feedback. I really appreciate your effort on this.

I have tried to implement "CSS pseudo-classes" in my upcoming challenge. For sure, it makes life easier. Sometimes, it's hard to keep all the elements or properties at the back of the brain. I'm definitely at a level where I already know if some code is not being logical, and/or simple enough to make sense. So I try to take the help of my custom GPT to recommend some solutions or browse through documentation.

Anyways, thank you so much for your help.

Cheers😁

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