Submitted almost 2 years ago
3 Column Preview Card Component
@erandakarachchi
Design comparison
SolutionDesign
Solution retrospective
- Is writing CSS for nth-child can be considered a best practice for scenarios like this?
- Is there any proper way that can be used to implement this
Thanks for your time
Community feedback
- @MelvinAguilarPosted almost 2 years ago
Hi there ๐. Good job on completing the challenge ! I have some feedback for you if you want to improve your code.
My humble opinion is that using nth-child is not a bad practice, but if for some reason there's a new car component at the beginning, you would have to sort the order of nth-child
HTML:
- You must use a level-one heading (h1) even though this is not a full-page challenge. You can create an '<h1>' element within your 'main' element that will be hidden visually but visible and readable by screen readers. The class "sr-only" hides content visually and here are the styles to copy. e.g.:
<h1 class="sr-only">3-column preview card component</h1>
- Avoid using uppercase text in your HTML because screen readers will read it letter by letter. You can use the
text-transform
property to transform the text to uppercase in CSS.
- The <div> tag defines a division or section on a website. It is used to style a container with CSS, set special alignment, or position content. You should use the
<a>
tag instead of the<div class="learn-more orange-text">
tag because theLearn More
element is a link to another page.
- Not all images should have alt text. Car icons are for decoration purposes only, so they can be hidden from screen-readers by adding
aria-hidden="true"
and leaving its alt attribute empty:
<img src="./images/icon-sedans.svg" alt aria-hidden="true"> <img src="./images/icon-suvs.svg" alt aria-hidden="true" > <img src="./images/icon-luxury.svg" alt aria-hidden="true" >
CSS:
- The container isn't centered correctly. You can use flexbox or grid layout to center elements. You can read more about centering in CSS here.
- You could use a CSS Reset to remove browser built-in styles and reduce browser inconsistencies.
Popular reset style sheets:
I hope you find it useful! ๐ Above all, the solution you submitted is great!
Happy coding! ๐
Marked as helpful1@erandakarachchiPosted almost 2 years ago@MelvinAguilar Thank you so much for the feedback. I learned a lot from this โค๏ธ
1 - You must use a level-one heading (h1) even though this is not a full-page challenge. You can create an '<h1>' element within your 'main' element that will be hidden visually but visible and readable by screen readers. The class "sr-only" hides content visually and here are the styles to copy. e.g.:
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