Not Found
Not Found
Not Found
Your session has expired please log in again.
Your session has expired please log in again.
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

Responsive grid layout chalange solution

adrnmatosโ€ข 150

@adrnmatos

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


Text overflows when rendered at mobile widht size with chome dev tools and required font-size. Need help with typography.

Community feedback

@MelvinAguilar

Posted

Hello there ๐Ÿ‘‹. Good job on completing the challenge !

  • It seems like the issue you're facing isn't related to typography but more about how you've centered and set the height for the component. Your current CSS for the container is causing it to overflow.

    The height you've set is making the solution behave strangely, particularly on smaller screens, and the percentage-based width can also distort the layout on larger screens, you can remove it.

    .container {
        /* position: absolute; */ /* Eliminate this way of centering, in the next point I will explain why. */
        /* top: 50%; */
        /* left: 50%; */
        /* transform: translate(-50%, -50%); */
        /* width: 80%; */
        /* height: 80%; */
        max-width: 1000px;
        display: grid;
        grid-template-columns: 100%;
        grid-template-rows: 40% 30% 30%;
    }
    
    @media only screen and (min-width: 1440px) {
      .container {
        /* width: 45%; */
        /* height: 60%; */
        grid-template-columns: 50% 50%;
        grid-template-rows: 45% 55%;
      }
    }
    
  • Avoid using position: absolute to center an element as it may result in overflow on some screen sizes. Instead, utilize the flexbox or grid layout for centering. Get more insights on centering in CSS here here ๐Ÿ“˜.

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

I hope you find it useful! ๐Ÿ˜„

Happy coding!

Marked as helpful

1

adrnmatosโ€ข 150

@adrnmatos

Posted

@MelvinAguilar Hi. Thank you for the your reply. I had tested and it works much better.

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