我有一些CSS,我正在使用flex。
这是代码:
.flex-container {
display: flex;
align-items: stretch;
background-color: #ff0000;
}
.flex-container > div {
background-color: DodgerBlue;
color: white;
margin: 10px;
text-align: center;
}
<div class="flex-container">
<div style="flex-grow: 1">left</div>
<div style="flex-grow: 60">auto</div>
</div>
现在,它正在做我想做的事情,即我并排有2个不同大小的div。
但是我还需要1件东西。
我需要这2个div的高度也要伸展。
我怎样才能做到这一点?
只需为容器提供height属性,然后这些项目就会自动获得拉伸,请检查下面的代码段。