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 (Grid and Flex)

@MichaelKanios

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 all , i am not satisfied with my result. I need to understand more about positioning and how dimensions works. Any advise? Thanks for your time

Community feedback

Adriano 34,090

@AdrianoEscarabote

Posted

Hi Michael Kanios, how are you? I really liked the result of your project, but I have some tips that I think you will enjoy:

A good practice to center content is using grid or flex-box, avoid using margin or padding to make placements, use only in the latter case! we can do it like this:

Flex-box:

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

GRID

body {
    display: grid;
    min height: 100vh;
    place-content: center;
}

The rest is great!

I hope it helps... 👍

Marked as helpful

0

@MichaelKanios

Posted

@AdrianoEscarabote Thank you very much for your great and helpfull response.

0

@rubenao

Posted

Hey Michael Kanios :), I see your code and I have a suggestion for center the component:

  1. You can use display: grid; place-items : center; to center the component. Before that you need to set width: 100% and min-height: 100vh to the body selector

  2. You can use display:flex ; justify-content: center ; align-items:center . Before that you need to set width: 100% and min-height: 100vh to the body selector

Hope that this help you. Well done! Happy coding :)

Marked as helpful

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