一、需求
1. 容器元素高度自适应
2.第一个子元素固定高度,第二个子元素自适应高度
<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>测试</title>
<style>
*{
margin: 0;
padding: 0;
}
.container{
position: fixed;
top: 130px;
right: 0;
bottom: 0;
left: 0;
}
.parents{
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
}
.child1{
width: 100%;
height: 100px;
background-color: aqua;
}
.child2{
flex: 1;
background-color: black;
}
</style>
</head>
<body>
<div class="container">
<div class="parents">
<div class="child1"></div>
<div class="child2"></div>
</div>
</div>
</body>
</html>
版权声明:本文为m0_37616866原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。