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

My first solution using CSS Flexbox

Mu Solomon 110

@Mu-Solomon

Desktop design screenshot for the Order summary component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Please, how can I center a div element both horizontal and vertical?

Community feedback

Fidel Lim 2,775

@fidellim

Posted

Hi Solomon,

Greta job finishing the project, to answer your question, you can copy this code:

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

Hope it helps :)

Marked as helpful

1

@Gabrielbe17

Posted

Hi Solomon, I suggest you to use grid.

  • Use display:grid; , place-items:center; to the grid container. In your case, the body Tag.

I also suggest you to add min-height:100vh; To its container.

Marked as helpful

0
Anar 700

@anar-sol

Posted

Hello! You can center an element by adding theses rules to its container .container { display: flex; justify-content: center; align-items: center; }

To center the element on the screen add this rule to its container .container { min-height: 100vh; }

Marked as helpful

0
Mu Solomon 110

@Mu-Solomon

Posted

Thanks 🤝 for being there guys, I'm really pleased 😌 🙏🏼

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