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

HTML and CSS only

Amr Fouad•90
@A-Fouad-Code
A solution to the Stats preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


If you have any comments or ideas on how I can make my code better or the design look better please share your thoughts with me.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Trevor Merrick•150
    @tmerrick17
    Posted over 3 years ago

    Hey Amr Fouad, first of all a great go at this project. Here is some feedback I would love to give you. I downloaded the files and took a deep dive so here it goes.

    Things that worked well:

    • CSS Reset is always a good idea. The basics you have exactly there.
    • Custom CSS3 variables. Another good one that is so helpful, especially if you look at working in SCSS/Sass.

    Things to ponder:

    • Best practice is to leave out unit (eg. 0 instead of 0px). This is nit-picky but a good standard to show other developers that you have the basics down. grid-column-gap: 0px; turns into `grid-column-gap: 0;

    • Definitely try to practice mobile first (look up Youtube videos, here's a good example.

    • Also when you hit 769px at that spot, the card is half out of the viewport. Try something around 1200px?

    • Try using px rather then % for border-radius:. Start with 20px and go from there?

    • What if you took off .parent .div1? Try to not nest these already customized classes you've created. See what happens on the webpage, hopefully the answer is nothing. This could save you time writing code you might not need to type out.

    Example:

    .parent .div1 .txt h1 {
        font-size: 1.6em;
        padding-left: 0;
      }
    

    ...turns into...

    .txt h1 {
        font-size: 1.6em;
        padding-left: 0;
      }
    
    • Try using more descriptive classes then div2 but general like card-image? Too specific would be purple-image-of-people. Hopefully you get the idea.

    Ok, I know that was long but I wanted to be as thorough as possible. You have done a great job at getting this far. Going back and tweeting while it might feel sucky, it means you are growing in your coding. So am I. I've only been coding for a a year now and really have enjoyed it. Hope to see more of your work!

    Marked as helpful
  • Harsh Jain•475
    @thisisharshjain
    Posted over 3 years ago

    Heyy @A-Fouad-Code, I'll point out a few things here,

    1. Main card isn't centered instead on top-left side
    2. Color overlay on image doesn't looks that good. maybe change the opacity a little
    3. Try to use semantic elements when possible
    4. Reducing the padding-top on .stats will look better
    5. It kinda breaks between 770-1199px Except these few small issues, You've done a good job! 😄 Kepp grinding 💪🏻

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 1st-party linked stylesheets, and styles within <style> tags.

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.

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