如何让flexbox儿童100%的父母身高?
我正在尝试填充flexbox内的flex项目的垂直空间。
.container {
height: 200px;
width: 500px;
display: flex;
flex-direction: row;}.flex-1 {
width: 100px;
background-color: blue;}.flex-2 {
position: relative;
flex: 1;
background-color: red;}.flex-2-child {
height: 100%;
width: 100%;
background-color: green;}<div class="container"> <div class="flex-1"></div> <div class="flex-2"> <div class="flex-2-child"></div> </div></div>
这是JSFiddle
flex-2-child 没有填写所需的高度,除非在以下两种情况下:
flex-2 高度为100%(这很奇怪,因为弹性项目默认为100%+ Chrome中存在错误)
flex-2-child 有一个绝对的位置也很不方便
这在目前的Chrome或Firefox中不起作用。
泛舟湖上清波郎朗
呼唤远方
MM们
随时随地看视频慕课网APP