2021/3/17 浮动布局学习
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>浮动布局(2)</title>
<style>
.a {
width: 20%;
background: orangered;
}
.b {
width: 60%;
background: green;
}
.c {
width: 20%;
background: blue;
}
.a,
.b,
.c {
float: left;
height: 200px;
}
.hh {
height: 360px;
background: gray;
}
.outer {
/* 父元素包裹子元素时要设置高度,如果不设置可以利用overflow进行调整 */
/* height: 200px; */
overflow: auto;
/* clear元素 */
/* clear: left;不受左浮动影响; right不受右浮动影响 both都不受影响 */
}
</style>
</head>
<body>
<div class="outer">
<div class="a"></div>
<div class="b"></div>
<div class="c"></div>
</div>
<div class="hh">
</div>
</body>
</html>
效果图