Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 2 years ago

Stats preview card component with flexbox and grid

accessibility
Shaun•180
@DevShaunB
A solution to the Stats preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hi, I have a few questions about accessibility best practices regarding lists. I used an unordered list for stats (10k+ companies, 314 templates, 12m+ quotes),

  • I wanted to give this list a meaningful title without changing the UI so I added an h2 and wrapped both h2 and ul in a div, is this the best approach? I could use aria-labelledby instead of wrapping a div, or just an aria-label to eliminate both h2 and div?

  • I wanted screenreaders to read "over 10 thousand companies" instead of "10k+ companies", so I created a span with desired text and made it available for screen-reader only. I also used "aria-hidden" on "10k+ companies" to avoid confusion. Is it the best practice? Or should I use an aria-label on "10k+ companies" instead and eliminate the span with desired text ("over 10 thousand companies") ?

Also, what's the deal with image overlay? I couldn't get it to look exactly like the design using the colors given in the style-guide. I used a wrapper around the image and used a pseudo-element (::before) to create an overlay with 60% opacity. I'm I missing something here?

Thanks!

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Shaun's solution.

Join 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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License