Design comparison
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
- @PhoenixDev22Posted about 2 years ago
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 wrapEquilibrium #3429
.- The link wrapping the equilibrium image should either have
Sr-only
text, anaria-label
oralt
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 addaria-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 helpful0@kamilp522Posted about 2 years agoThanks 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 - You can use the
- @DavidMorgadePosted about 2 years ago
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 helpful0@kamilp522Posted about 2 years agoHey 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 addingvertical-align: top
to myimg
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 :D1@DavidMorgadePosted about 2 years ago@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 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