我有一个项目,这里用一个名为large-child
的空div表示,它有一个固定的高度.这将控制灰色parent
的高度.我想要做的是允许child-flex
垂直填充空间,所以我将其设置为large-child
%.不过,这似乎行不通,到目前为止,让child-flex
盒填满空间的唯一方法是让它比large-child
盒更大.
有没有办法让这件事行得通?
.parent {
display: flex;
width: 100%;
background-color: gray;
align-items: center;
height: fit-content
}
.child-flex {
display: flex;
height: 100%;
background-color: blue;
}
.large-child {
background-color: red;
width: 50px;
height: 50px
}
<div class="parent">
<div class="large-child"></div>
<div class="child-flex">
<a>Item 1</a>
<a>Item 2</a>
<a>Item 3</a>
</div>
</div>