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

Single price grid component

Talasa 130

@TalasaDev

Desktop design screenshot for the Single price grid component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Hi everyone,

I just finished the single-price-grid-component challenge. There are "things" happening when in desktop design. The component is not centered in the screen but the margin is set to auto. Does anyone see the problem?

Thanks, Happy coding!!

Talasa

Community feedback

@amalkarim

Posted

Hi Talasa, congratulations for completing the challenge!

I think the problem lies in this code:

body {
    width: 375px;
    max-width: 400px;
    margin: auto;
}

The browser will assume that body's width is always 375px (smaller width overrides max-width), therefore it will calculate the center position based on that number. Remove width: 375px; and max-width: 400px; to solve the problem. Or, just remove them all, because margin: auto; here doesn't do anything.

To position the <div class="container"> in the middle of the page, instead of using margin: auto;, I suggest better solution using flex. Like this:

body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

Hope this helps. Let me know if there's still something that needs to be addressed.

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