As I understood from the documentation the justify-items would center it on the main axis and align-items would center it on the cross axis. So why is it, that the center-box is only aligned on the cross-axis (now vertical)?
By changing to flex-direction: column;
it will horizontally align, but again the main axis seems to get ignored and so it will not center vertically in this case.
.flex
{
display: flex;
justify-items: center; /* Does not seem to work */
align-items: center;
}
.center-box
{
background: green;
}
/* Flavor */
.flex
{
margin: 0 auto;
width: 200px;
height: 200px;
background: red;
}
<div class="flex">
<div class="center-box">Center Box</div>
</div>