I'm playing around with flex-direction:column
to understand this property better. Here's a Codepen of my code and a snippet below :
.container {
display:flex;
flex-direction:column;
justify-content:space-between;
align-items:center;
max-width: 800px;
height: 500px;
border: 1px solid black;
}
div div
{
text-align:center;
padding:30px 30px;
width:20%;
flex:1;
}
.red { background-color:red; }
.orange { background-color:orange; }
.yellow { background-color:yellow; }
.green { background-color:green; }
.blue { background-color:blue; }
<div class="container">
<div class="red">RED</div>
<div class="orange">ORANGE</div>
<div class="yellow">YELLOW</div>
<div class="green">GREEN</div>
<div class="blue">BLUE</div>
</div>
Notice the text in the colored boxes are not vertically aligned. What causes this, and is there a way to align them vertically without nesting flexboxes within flexboxes?