I am trying to vertically align the white boxes so they are at the middle of the picture. I tried using align-items: center; but then I would need to add height to the row class which I don't want to.
http://codepen.io/VK72m/pen/ZeLaNx
<div class="container">
<div class="row">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</div>
<div class="row">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</div>
body {
margin: 0;
padding: 0;
font-size: 100%;
}
.container {
align-items: center;
margin: 0;
padding: 0;
height: 19em;
width: 20em;
background-color: black;
background: url("https://images.pexels.com/photos/340779
/pexels-photo- 340779.jpeg?w=1260&h=750&auto=compress&cs=tinysrgb");
background-position: -22em ;
}
.row {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
.box {
margin: 0;
padding: 0;
height: 3em;
width: 3em;
margin: 0.9em;
background-color: white;
}
