nft-preview-card-component using CSS positioning and flex property
Design comparison
Community feedback
- @correlucasPosted about 2 years ago
👾Hello @ArchieK9, Congratulations on completing this challenge!
Great code and great solution! I’ve few suggestions for you that you can consider adding to your code:
Its really nice that you’ve used some animation and effects! Something to improve the accessibility its to add a media query reducing the motion.The prefers-reduced-motion CSS media feature is used to detect if the user has requested that the system minimize the amount of non-essential motion it uses. Here’s the code for that:
/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */ @media (prefers-reduced-motion: reduce) { html:focus-within { scroll-behavior: auto; } *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; } }
✌️ I hope this helps you and happy coding!
Marked as helpful0 - @denieldenPosted about 2 years ago
Hello Achilike, You have done a good work! 😁
Amazing custom animation :)
Some little tips to improve your code:
- add
main
tag and wrap the card for improve the Accessibility - also you can use
article
tag instead of a simplediv
to the container card for improve the Accessibility - Using
<hr>
for the line is not the best way because this tag have a semantic meaning... in this case use div withborder-bottom
because this line is decorative - remove all unnecessary code, the less you write the better as well as being clearer: for example the
div
container without essential utility or scope - remove all
margin
fromcard
class - use flexbox to the body to center the card. Read here -> best flex guide
- after, add
min-height: 100vh
to body because Flexbox aligns child items to the size of the parent container
Keep learning how to code with your amazing solutions to challenges.
Hope this help 😉 and Happy coding!
Marked as helpful0@ArchieK9Posted about 2 years ago@denielden Thanks for commenting on the animation. I'll take these corrections into consideration
1 - add
- @VCaramesPosted about 2 years ago
Hey @ArchieK9, some suggestions to improve you code:
- To center your content to your page, add the following to your Body Element:
body{ min-height: 100vh; display: flex; justify-content: center; align-items: center; }
-
The NFT Alt Tag description needs to be improved upon. You want to describe what the image is; they need to be readable. Assume you’re describing the image/icon to someone.
-
The Icons serve no other purpose than to be decorative; They add no value. Their Alt Tag should left blank and have an aria-hidden=“true” to hides it from assistive technology.
-
The "NFT image", "Equilibrium #3429" and "Jules Wyvern" in an Anchor Tags <a>. The anchor tag will allow users to click on content and have them directed to another part of your site.
-
Delete all the Break Elements you have, they are unnecessary.
-
A lot of the headaches and and repeated properties can be be overcome by implementing a proper CSS Reset.
Here are few CSS Resets that you can look at and use to create your own or just copy and paste one that is already prebuilt.
https://www.joshwcomeau.com/css/custom-css-reset/
https://meyerweb.com/eric/tools/css/reset/
http://html5doctor.com/html-5-reset-stylesheet/
Happy Coding!
Marked as helpful0@ArchieK9Posted about 2 years ago@vcarames I'll look into that. Thanks for your contribution
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