Вы можете удалить align-items: flex-start;
из .flexcontainer
.flexcontainer {
display: flex;
flex-wrap: wrap;
/* align-items: stretch; */ /* default */
}
.flexchild {
display: block;
position: relative;
flex-basis: 140px;
flex-grow: 2;
vertical-align: sub;
color: white;
padding: 12px;
flex-direction: row;
}
.first {
background-color: red;
}
.second {
background-color: blue;
}
<div class="flexcontainer">
<div class="flexchild first">
1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9
</div>
<div class="flexchild second">
this should be as high as the red child
</div>
</div>
Или вы можете установить align-self: stretch;
для .second
.flexcontainer {
display: flex;
align-items: flex-start;
flex-wrap: wrap;
}
.flexchild {
display: block;
position: relative;
flex-basis: 140px;
flex-grow: 2;
vertical-align: sub;
color: white;
padding: 12px;
flex-direction: row;
}
.first {
background-color: red;
}
.second {
background-color: blue;
align-self: stretch;
}
<div class="flexcontainer">
<div class="flexchild first">
1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9
</div>
<div class="flexchild second">
this should be as high as the red child
</div>
</div>