NFT card using Sass and some simple transitions
Design comparison
Solution retrospective
Any feedback is welcome of course, but if you have some tips on how to optimize my code in Sass (especially if you spot any opportunities for code reusability and/or better organization), that would be highly appreciated! :)
Community feedback
- @denieldenPosted about 2 years ago
Hi Kristina, congratulations on completing the challenge, great job! π
Very clean code and amazing animation on the hover effect!! I love it.
Some little tips for optimizing your code:
- use the
main
tag to wrap the card and improve the Accessibility - 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
Hope this help! Happy coding π
Marked as helpful0@KristinaRadosavljevicPosted about 2 years ago@denielden Thanks for your feedback, Deniel! :)
I did consider just using a border for the line, but I wasn't aware that
<hr>
is semantic so I opted for that. Lesson learned! :DAnd I actually did use the
<main>
tag for the entire card in HTML, I just selected it using its class name in CSS, not sure if that messes with accessibility somehow and what the best approach is?Anyway, great points and thanks again for taking the time to review my solution, much appreciated! :)
1@denieldenPosted about 2 years ago@KristinaRadosavljevic You are welcome and keep it up :)
The best approach is to use main for the purpose of accessibility and then use it to contain all the central elements and contents of the page, as written in the docs
The <main> HTML element represents the dominant content of the <body> of a document. The main content area consists of content that is directly related to or expands upon the central topic of a document, or the central functionality of an application.
1 - use the
- @correlucasPosted about 2 years ago
πΎHello @KristinaRadosavljevic, Congratulations on completing this challenge!
Wow! This hover effect is just amazing!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@KristinaRadosavljevicPosted about 2 years ago@correlucas Thanks, Lucas, I'm really glad you liked the hover effect, I am kind of proud of it :D
And also, your comment was really helpful, I wasn't even aware of this media feature but it sure seems handy, I'll definitely try to remember to use it in the future!
Thanks again! :)
1
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