1 foot固定底部 但是子类内容高度大于100%会随着下移2 子类最小高度100% (所以body需要设置高度)3 foot和body是兄弟关系 不可以包在body里
1 回答
业余奶茶品鉴师
TA贡献260条经验 获得超388个赞
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
* {
padding: 0;
margin: 0;
}
.body {
background: green;
width: 100%;
min-height: 96%;
}
.foot {
background: orange;
width: 100%;
height: 4%;
}
.child {
width: 40%;
height: 1000px;
background: red;
}
</style>
</head>
<body>
<div class="main">
<div class="body">
<div class="child"></div>
</div>
<div class="foot"></div>
</div>
</body>
</html>采纳下吧
- 1 回答
- 0 关注
- 1085 浏览
添加回答
举报
0/150
提交
取消
