Just trying some things out with Flexbox, and I'm getting an undesired gap between the .header
and the .section
s.
Because of flex: 0 100%
and align-self: flex-start
, .header
should take up the entire first row, as it does.
But then since align-items: stretch
on #container
, I expected the three .section
s to fill up the rest of the vertical space, from the bottom of .header
to the bottom of #container
. But instead there is a large gap between the two rows. First time using Flexbox, and I'd appreciate any help.
NOTE: I haven't added all prefixes to the CSS, so not sure which browsers this can be seen in.
#container {
display: -webkit-flex;
display: flex;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-align-items: stretch;
align-items: stretch;
height: 300px;
background: lightblue;
}
.header {
margin: 0;
flex: 0 100%;
-webkit-align-self: flex-start;
align-self: flex-start;
border: 1px solid green;
}
.section {
-webkit-flex: 1 0%;
flex: 1 0%;
border: 1px solid blue;
}
<div id="container">
<div class="header">THIS IS THE HEADER</div>
<div class="section"></div>
<div class="section"></div>
<div class="section"></div>
</div>