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 approach and flexbox

P
Katrien S 1,070

@graficdoctor

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


I usually find it very easy to center my div, but as you'll see on mobile view, I didn't manage this time. I couldn't find a solution for this. If anyone has any tips on what I need to change, I'd love to hear them. Any other feedback is very much appreciated aswell.

Community feedback

Mark Mitchell 1,820

@markup-mitchell

Posted

Hi Katrien,

From what I can see it is centered on mobile, it's just that there's no additional space available to appear at the top and bottom because the <body> is set to height: 100vh.

If I understand your problem, maybe the simplest solution is to add, say 5rem of padding-top and padding-bottom to the body tag?

In general terms, your structure is unconventional and potentially problematic. I would expect to body, main, and section tags to be nested in the following order:

<body>
    <main>
        <section>
        </section>
    </main>
</body>

Have a look at this page on <section> semantics.

Marked as helpful

0

P
Katrien S 1,070

@graficdoctor

Posted

@markup-mitchell Thank you for having a look. I'm slow in understanding semantic html, but will focus on that more the coming days, to make sure I don't make any more unconventional structures. In this case I deleted all section-tags and added main in the correct place. I added the padding aswell, which does make it look a bit better om mobile.

0
Mark Mitchell 1,820

@markup-mitchell

Posted

@graficdoctor nice work!

Semantic HTML can be confusing. The nice thing about it is that it's not all-or-nothing. Every little piece you learn makes things slightly better and it all adds up.

Slow and steady wins the race!

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