清除浮动的三种方式
<!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> 清除浮动</title>
<style>
.son_1 {
float: left;
width: 300px;
height: 200px;
background-color: greenyellow;
}
.son_2 {
float: left;
width: 300px;
height: 200px;
background-color: skyblue;
}
.info {
width: 300px;
height: 400px;
background-color: gray;
}
.son_3 {
clear: both;
}
.one::after {
content: '';
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.one::after,
.one::before {
content: '';
display: table;
}
.one::after {
clear: both;
}
</style>
</head>
<body>
<div class="one">
<div class="son_1"></div>
<div class="son_2"></div>
</div>
<div class="info">
</div>
</body>
</html>
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/6a0cf551b8489c0ba38bcedb1aff4f6a.png)