Kendpr• 290
@RealKendpr
Posted
I checked your code on github and I see that you used margin: auto;
to center your .container
horizontally, but based on the design you still have to center it vertically.
To do that you can use one of the following: First remove the auto margin then proceed
- Absolute positioning
You can add this code inside your
.container
:position: absolute; top: 50%; left: 50%; transfrom: translate(-50%,-50%);
- Centering it with grid
or do this instead:
Make the parent element of your
.container
(which in your case isbody
) a grid:body {display: grid; place-items: center;}
Just take note that by using this every sibling of your.container
will also be centered, so they might be covered by the other sibling
It should center it both horizontally and vertically
Marked as helpful
0
Laysa Diniz• 30
@santosdlaysa
Posted
Thank you for your help, it was very useful. @RealKendpr
0