我在flexbox列中遇到了问题,flex'd元素的子元素对height
的百分比没有响应.我只在Chrome中判断过这个问题,据我所知,这是Chrome唯一的问题.以下是我的例子:
HTML
<div class='flexbox'>
<div class='flex'>
<div class='flex-child'></div>
</div>
<div class='static'></div>
</div>
CSS
.flexbox{
position:absolute;
background:black;
width:100%;
height:100%;
display: flex;
flex-direction:column;
}
.flex{
background:blue;
flex:1;
}
.flex-child{
background:red;
height:100%;
width:100%;
display:block;
}
.static{
background:green;
width:100%;
height:5rem;
}
我想要它,让红色的.flex-child
填满蓝色的.flex
.为什么height:100%
不起作用?