Height of parent of flex elements in CSS
If the parent of a flex element does not have a height set, then it will be stretched by its contents, that is, the height of its descendants:
<div class="parent">
<div class="child">1</div>
<div class="child">2</div>
<div class="child">3</div>
</div>
.parent {
display: flex;
width: 300px;
border: 1px solid red;
}
.child {
width: 50px;
height: 50px;
border: 1px solid green;
}
: