center with flexbox
Hi everyone
I want center the content of my body but I don' t know what is going wrong
html code:
my css:
9 Replies
the container is centered, then it has a single flex child
.info
which by default takes up 100% of its parent
the contents of .info are just displayed by the default rulesalign-items not align-content 🙂
align-content is for grid
also, change height to min-height on the body. if your screen gets to narrow, it will cause issues
with align-items i get
and justify-content center to get it to the middle, that line was correct
if you do it with grid, you can do it with a single line
display: grid
place-items: center
thanks for your answer .info is a child of .container