preview card using flex box and sass(first time using sass)
Design comparison
Solution retrospective
Hello, I am just curious about my html setup and the css organization that I used. also, first time using sass and I liked it. I used divs everywhere and I know that I should used more semantic html, but I am not sure what to use in each situation. also, for the css I am curious when to use a container and when it is not needed. could you provide some feedback on that. thank you very much.
update: I corrected all the accessibility issues I think and wrapped all the content in a main tag instead of a div container. also added some margin below the nft symbol and days remaining to more closely match the design.
Community feedback
- @pikapikamartPosted almost 3 years ago
Hey, awesome work on this one. The layout in general I think looks great.
David Turner already gave a feedback on this, just going to add some suggestions as well ( don't mind me re-iterating some points from David:> )
- First, congrats on your first challenge here at FEM and I hope you find this fun to do and informative as well.
- The reason for changing the
.container
tag to usemain
tag is because on a page, amain
element is always needed. Themain
tag will contain the main-content of the site, this helps others users like screen-reader users to properly navigate and know information from landmark elements like themain
tag. - Avoid using
height: 100vh
on a large container like the.container
as this makes the element's height capped based on the viewport/screen's height. Instead usemin-height: 100vh
so that the element will expand if it needs to. - Whenever you make a component interactive one, then there must be an interactive element placed on it. For example, since if you hover on the image, there appears an overlay that have a preview-icon right, meaning that this image is could be interacted by the user, hence there should be something like a
button
, focusable elements likebutton, input, link
are interactive elements. For this one, if you think that when clicking the image creates a modal or pop-up on the screen where you can see the full nft, thenbutton
would be nice, but if clicking the image redirects the user to another page, thena
tag would fit better. I haven't made this challenge yet so I can't give a reference, but I hope you got some insights about interactivity. - For the nft image, since the nft's name is already present, then using that as the
alt
value for theimg
would be really nice likealt="equilibrium"
. - Since the preview-icon is just decorative, we want it to be hidden for screen-reader users. Normally when you use
alt=""
on animg
, you want to addaria-hidden="true"
attribute on theimg
tag as well so that the image will be complete hidden for screen-reader users. - Same for the nft name heading tag, it is being treated as an interactive element, you can use
a
tag inside the heading tag to wrap the text:
<h1> # use h1 since h1 is needed for every page <a href="#"> Equilibrium #3429 </a> </h1>
- You can as well use
ethereum
as the eth-icon'salt
value since the currency is real though. - When wrapping up a text-content, make sure that it is inside a meaningful element like
p
tag or heading tag and not using likediv, span
to wrap the text. - For the person, since the person's name is present as well, using it on the
img
alt
would be really nice. - Same as well for the person's name, it is being treated as interactive. Instead of
span
for the person's name, usea
tag.
Aside from those, great job again on this one.
0@mscatesPosted almost 3 years ago@pikapikamart thank you for the help. I made all the changes you requested. this will really help me with next challenge I am working on. feedback helps so much.
1 - @brodiewebdtPosted almost 3 years ago
This looks very good. If you add the container styling to the body tag and change the container div to a Main tag it will clear the accessibility warnings. You also should change the Equilibrium H3 to an H1. every page should a level one heading for semantic reasons.
Download AXE DevTools and you can clear accessibility warnings while you code. https://www.deque.com/axe/devtools/
Hope this helps.
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