Design comparison
Solution retrospective
I found difficult to center the design vertically. Im not sure if i centered the design as it should or as i could be centered, i created a container with a specific heigth and then i centered using flex box. I would like to know if it was necessary to add a general left, right, bottom and top margin. I insted centered everithing and applied an specific size to the desing.
Community feedback
- @harshitBhardwaj97Posted about 1 year ago
I saw your code and found that you wrapped the entire code inside the class design-container and in gave it height of 650px :-
.design-container { display : flex; align-items : center; height : 650px; }
You can refrain from restricting the height of parent container, and for centering the content vertically, you can use this approach :-
.design-container { display : grid; place-content : center; min-height : 100vh; }
Or you can also do :-
.design-container { display : flex; align-items : center; justify-content : center; min-height : 100vh; }
I hope you find this suggestion helpful and it solves your problem, Happy Coding !
Marked as helpful1@EnrikewoqPosted about 1 year agoVERY HELPFULL thank you sm! haha i was trying to be the most accurate possible thanks!@harshitBhardwaj97
0 - @pRicard0Posted about 1 year ago
You should add this to your body:
body { min-height: 100vh; justify-content: center; }
You can also add a box-shadow to your .design
.design { box-shadow: 0px 7px 14px #0000001a; }
Marked as helpful1@EnrikewoqPosted about 1 year agoThanks sr, i will, your commet is really helpfull@pRicard0
0 - @zakura1xPosted about 1 year ago
I think to center the card you can add min-height:100vh to the body css
Marked as helpful1
Please log in to post a comment
Log in with GitHubJoin 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