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

profile card

Femi 300

@femizi

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


how do i centralize a div alone in the middle of the screen

Community feedback

Victor Eke 190

@Evavic44

Posted

There are several ways in doing that, all depends on the use case.

div { margin: 0 auto; }

div { position: relative; top: 50%; left: 50%; }

3 Or use a transform property div { transform: translate(50vw, 50vh); }

1

@abubakarMana01

Posted

@Evavic44 You should also be aware that the div has to have width and height set if you're to use {margin: auto}. The parent container in this case I believe should be the body also needs to have a height so you can centralize vertically as well. 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