<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>超强-上下两个div上面值固定下面铺满高度</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
.parentDiv {
width: 100%;
height: 100%;
position: absolute;
display: flex;
flex-direction: column;
}
.childDiv1 {
background-color: blue;
width: 100%;
height: 200px;
}
.childDiv2 {
background-color: red;
width: 100%;
flex: 1;
}
</style>
</head>
<body>
<div class="parentDiv">
<div class="childDiv1">1111</div>
<div class="childDiv2">
2222
</div>
</div>
</body>
</html>
HTML上面div固定高度,下面自适应高度
最新推荐文章于 2023-09-07 18:12:38 发布