I am trying to center a red square in the middle of the page.
I set the flex container to 100% in height, and also set html, body to 100%, and it still does not align the center.
Can anyone help me understand why it is not working? Thanks!
html, body { height: 100%; } .flex-container { display: flex; flex-flow: column; justify-content: center; height: 100%; } .box { flex: 0 0 100px; background: red; width: 100px; }
<div class='flex-container'> <div class='box'></div> </div>
source share