Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Mobile-first | Grid and Flexbox | Stats preview card component

dkaffesā€¢ 140

@dkaffes

Desktop design screenshot for the Stats preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


There is a breakpoint at 60rem (960px) switching from mobile to desktop version.

From 960px and up to 988px the image does not fit well in its parent .image-box and a white space (with the violet background color of the parent box on top) below the image shows up.

How can I fix that?

Any help will be appreciated!

Community feedback

P
Graceā€¢ 28,570

@grace-snow

Posted

I hope this is helpful

  1. Change sections to divs in this. You can add a section for the whole wrapper component inside main if you want, but the two halves should not be sections. A section would need a heading, not just an image.
  2. You should be including a modern css reset at the start of the styles in every project. Andy Bell has a good one you can look up and use. Get into that habit ASAP.
  3. The problem you are seeing with the image caused by missing object fit cover on the img element. You may need height and width 100% on desktop too.
  4. Try to avoid using complex css selectors like direct child selectors unless you have no choice. You want to keep css specificity as low as possible.

Marked as helpful

1

dkaffesā€¢ 140

@dkaffes

Posted

Thank you @grace-snow for your really helpful tips!

  1. Pretty useful!
  2. The (more) modern CSS reset by Andy Bell is very detailed and possibly not all parts are needed for the challenge? I will look into it in more detail.
  3. That solves the problem!
  4. Really useful tip. I will study more on the specificity subject!

Thank you for your time and effort!

0
P
Graceā€¢ 28,570

@grace-snow

Posted

@dkaffes don't mess around with resets, it's not worth it. Just include it all. It's actually WAY shorter than resets used to be!

1
Alok Sumanā€¢ 2,380

@Alokray007

Posted

Hello there šŸ‘‹

Good job on completing the challenge !

Your project looks really good!

I have a suggestion about your code that might interest you.

There is an very useful browser extension called Perfect Pixel that allow you compare with the design image and thus see the exact dimensions. I recommend it to you.

šŸ“Œ Tags like <div> and <span> are typical examples of non-semantic HTML elements. They serve only as content holders but give no indication as to what type of content they contain or what role that content plays on the page. This tag change does not impact your project visually and makes your HTML code more semantic, improving SEO optimization as well as the accessibility of your project.

I hope this suggestion is useful for future projects.

Other than that, great job!

Happy coding.

0

Please log in to post a comment

Log in with GitHub
Discord logo

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