您的位置:首页 > 其它

当元素使用flex布局,子级无法设置高度怎么办?

2017-10-28 15:25 956 查看

1.使用绝对定位

html

<div class="wrap">
<div class="header">头部</div>
<div class="main">
<div class="container">内容</div>
</div>
<div class="footer">尾部</div>
</div>


css

html,body{
width:100%;
height:100%;
}
.wrap{
width:100%;
height:100%;
}
.header,.footer{
height:40px;
}
.main{
display:flex;
postion:relative;
}
.container{
position:absolute;
width:100%;
height:100%;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  flex 布局
相关文章推荐