I am trying to align each child DIRECTLY after one another (vertically). Apparently align-items: flex-start
doesn't do that completely because there is some auto-spacing between each child.
Below is a snippet of the result I get. The children align themselves along their parent's available space, which is not what I like to achieve. What I want is each child to align directly after its previous sibling (vertically, as in the snippet).
Thanks in advance!
EDIT: flex-flow: column wrap
and align-content: flex-start
both did the trick. I forgot, however, to add align-self: flex-end
to the last child, which doesn't work when either of the two solutions above is applied.
* {
box-sizing: border-box;
}
#container {
position: fixed;
top: 0; right: 0; bottom: 0; left: 0;
display: flex;
align-items: flex-start;
flex-flow: row wrap;
}
#container > div {
width: 100%;
margin: 10px;
border: 2px solid #ff0000;
}
#container > div:nth-child(1) { height: 5%; }
#container > div:nth-child(2) { height: 10%; }
#container > div:nth-child(3) { height: 20%; align-self: flex-end; }
<div id="container">
<div></div>
<div></div>
<div></div>
</div>