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 product card component made with sass and flexbox

Kamil 120

@kamilp522

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


Hi everyone!

I've made :before element to add brightening effect when hover over main image but when i squeeze the viewport width enough, :before element doesn't stay inside image-wrapper even though it has width and height set up to a 100% of a parent element. Any idea why? link to the image

Community feedback

PhoenixDev22 16,950

@PhoenixDev22

Posted

Hi Kamil,

Congratulation on finishing this challenge. Great job on this one! I have few suggestions regarding your solution:

HTML

  • You can use the <main> landmark to wrap the NFT. And <footer> landmark to wrap the attribution, using landmarks is important to improve navigation experience on your site for users of assistive technology
  • The most important part in this challenge interactive elements. Since there's a :hover state on the image and means it's interactive, So there should be an interactive element around it. When you create a component that could be interacted with a user , always remember to include interactive elements like(button, textarea,input, ..) for this imagine what would happen when you click on the image, there are two possible ways: 1: If clicking the image would show a popup where the user can see the full NFT, here you use <button>. 2:If clicking the image would navigate the user to another page to see the NFT, here you can use <a>.

For the same reason, you can use <a> to wrap Equilibrium #3429 .

  • The link wrapping the equilibrium image should either have Sr-only text, an aria-label or alt text that says where that link takes you.
  • Images must have alt attribute. For any decorative images, each img tag should have empty alt="" and add aria-hidden="true" attributes to make all web assistive technologies such as screen reader ignore those images in (icon-view, icon-ethereum, icon-clock ).
  • Profile images like that avatar are valuable content. The alternate text of the avatar’s image should not be empty. You can use the creator's name Jules Wyvern. Read more how to write an alt text
  • For middle part of the card class="nft-eth-days-container", you can use an unordered list <ul>, in each <li> there should be <svg> and <p>. That way you can align them centrally.
  • There are so many ways to do the hover effect on the image, The one I would use is pseudo elements::before, ::after. You can use pseudo-elements to change the teal background color to hsla. Then the opacity can be changed from 0 to 1 on the pseudo element on the hover. Also using pseudo elements makes your HTML more cleaner as there's no need for extra clutter in the HTML. The icon view does not really need to be in the HTML. You can use CSS for it.

Hopefully this feedback helps.

Marked as helpful

0

Kamil 120

@kamilp522

Posted

Thanks for the feedback!

It's a whole lot of great advice. I'm still learning the basics and some of the html semantics still haven't set in my head.

I'll certainly go through everything you pointed out as I'll update this project in the future.

Thanks!!!

0
PhoenixDev22 16,950

@PhoenixDev22

Posted

@kamilp522 Glad to help. Happy coding!

1
David 8,000

@DavidMorgade

Posted

Hello Kamil congrats on finishing the challenge! your NFT looks great!

Did you already fixed your problem? because in my screen is not looking like in the screenshot you took, even resizing to 375px and still works, the only thing is that is not covering it at 100% because you set the height of your img to 98.5% instead of 100%.

If you are having trouble with the ::before trick, you could also add the effect just setting the background color on the wrapper div and playing with the opacity when you hover the image, just a little suggestion but both of the tricks takes you to the same spot (maybe the background div solution is easier to transition than the pseudoelement)

Hope my feedback helps you!

Marked as helpful

0

Kamil 120

@kamilp522

Posted

Hey David, thanks for the feedback!

I've set 98.5% height because wrapper went over image on google chrome for some reason. I fixed it with adding vertical-align: top to my img element.

Also I just updated my solution and used opacity on the image wrapper instead of ::before trick as you wrote and its much cleaner and simpler now. Thanks for the help :D

1
David 8,000

@DavidMorgade

Posted

@kamilp522 Yeah!, pseudoelements are powerfull tools but tricky to use, sometimes there is an easier way to get things done!

Great job with that workaround.

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