Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 3 months ago

A Responsive Stats preview card component

Zeinab Ali Mohamed•30
@Sweetysugaal
A solution to the Stats preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

I'm most proud of how quickly I was able to complete this project — within just 2 hours — while still achieving a result that matched my expectations both in design and functionality. Despite facing a few challenges with image overlays and border-radius behavior, I worked through them confidently and efficiently, and I learned important CSS techniques in the process.

What makes me especially proud is that I didn’t wait for everything to be perfect before starting. I pushed through uncertainty, solved the problems step by step, and saw the project come to life just as I envisioned it. This mindset of taking action and adjusting as I go is something I value deeply.

If I were to do things differently next time, I would spend a little more time planning the structure of the layout before diving into the code. For example, I could sketch the component visually or break it down into smaller, reusable parts. This would help improve maintainability and make the code even cleaner. I would also consider adding accessibility improvements, such as alt text and ARIA labels, and maybe even make the project interactive with JavaScript if the challenge allows it.

Overall, this project was a reminder of how much can be accomplished with focused effort and a growth mindset — even in just a couple of hours.

What challenges did you encounter, and how did you overcome them?

While working on this project, I encountered two main challenges that helped me deepen my understanding of CSS.

The first challenge was trying to apply a color overlay on top of an image. Initially, I attempted to give the container a background color and then set it to transparent, expecting it to layer over the image. However, I learned that this approach doesn't work as expected because transparent removes the background color entirely.

To overcome this, I researched and discovered the best practice is to create a separate div with a semi-transparent rgba() background and position it absolutely on top of the image. This gave me full control over the overlay and produced the effect I wanted.

The second challenge was that my card's border-radius was not visibly applying. I had styled it correctly, but the child elements — especially the image — were overflowing the container.

I resolved this by adding overflow: hidden; to the card container, which ensured that any overflowing content would respect the rounded borders. This helped me understand how overflow and border-radius work together in layout rendering.

Overall, these challenges were valuable learning moments that not only improved the design but also strengthened my foundational CSS knowledge.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • hitmorecode•7,560
    @hitmorecode
    Posted 3 months ago

    Nice well done. Just a few tips

    • On the left side you have too much white space. Try to make it evenly.
    • To make the overlay look more like the design file add this
    .color-overlay {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(166, 43, 242, 0.5); /* black with 40% opacity */
      pointer-events: none; /* allows clicks to go through */
    
    // add this
      mix-blend-mode: multiply;
    // change the opacity from 0.5 to 0.8 this will bring it closer to the design file
    }
    
    • Make it a habit using semantic html, avoid using divs.

    I hope you find this helpful. Keep it up 👍

    Marked as helpful

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

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub