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

Responsive Stats preview component using HTML & CSS

halovii•110
@halovii
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 specific areas of your project would you like help with?

Any help is appreciated!

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Adriano•42,890
    @AdrianoEscarabote
    Posted 7 months ago

    Hey halovii, how’s it going? I was really impressed with your project’s result, though I have some advice that could be helpful:

    To get closer to the photo overlay effect, you'd better use mix-blend-mode. All you need is the div under the image with this background color: hsl(277, 64%, 61%); and position mix-blend-mode: multiply and opacity: 80% on the image or apply image to activate the overlay by blending the image with the div's color. See the code below:

    img {
        mix-blend mode: multiply;
        opacity: 80%;
    }
    

    Everything else looks great.

    Hope this helps! 👍

    Marked as helpful
  • P
    Huy Phan•3,430
    @huyphan2210
    Posted 7 months ago

    Hi, @halovii

    I checked out your solution and wanted to share some suggestions:

    Reduce Overuse of Semantic Tags

    Your HTML currently includes two headers, two mains, and one footer. Ideally, you should use at most:

    • One header: It represents the introductory or navigational content.
    • One main: It represents the central content of the page.
    • One footer: It typically contains the closing information.

    Overusing these tags can confuse the document's structure and accessibility. Here's a simplified example based on your code:

    Instead of this:

    <body>
      <div class="wrapper">
        <div class="main-container">
          <!-- content -->
        </div>
      </div>
      <div class="attribution">
        <!-- your attribution -->
      </div>
    </body>
    

    You can do this:

    <body>
      <main>
        <!-- content -->
      </main>
      <footer class="attribution">
        <!-- your attribution -->
      </footer>
    </body>
    

    Why this is better:

    • The body itself acts as the best wrapper, so you don’t need an additional div.wrapper.
    • The .main-container can be replaced with a main tag since it represents the primary content.
    • Replace nested header, main, or footer elements inside your content with other semantic tags to avoid redundancy.

    Semantic HTML Without Confusion

    While it’s great to make HTML semantic, overusing or misplacing semantic tags can make the structure confusing. Avoid excessive use of generic divs, but also ensure semantic elements fit their purpose.

    Proper Use of Headings (h1, h2, etc.)

    You did well with the h1, as it serves as the main heading of the page. However, I noticed some numbers like "Companies," "Templates," and "Queries" are marked as headings. These don’t appear to be actual headings, as they’re more like statistics or labels. Remember:

    • h stands for "heading": It indicates a new section or subsection.
    • For numbers or non-heading content, consider using other tags like span or p to maintain proper hierarchy and clarity.

    Hope this helps!

    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
Frontend Mentor logo

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

Oops! 😬

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

Log in with GitHub