The height of a block element defaults to the height of the block's content, unless you define a specific height. And flexbox justify-content
defines how the browser distributes space between and around flex items. So it won't have any effects with flex-direction:column
by default.
In your example nav.flex-container
doesn't have any height defined, you can set either a percentage n%
(as you already set 100vh
on header
, the parent element) or vh
value to it.
nav.flex-container {
height: 80%; /*your value*/
}
Updated pen - https://codepen.io/anon/pen/LGRqzy
Or, set header
to display:flex
as well, and add flex:1
(grow) on nav.flex-container
.
header {
display: flex;
flex-direction: column;
}
nav.flex-container {
flex: 1;
}
Updated pen - https://codepen.io/anon/pen/WrGPMW
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…