<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>float</title>
<style>
div {
width: 200px;
height: 200px;
background-color: red;
}
#float_left {
float: left;
}
#float_right {
float: right;
height: 250px;
}
.general {
/* clear: left; */
/* clear: right; */
clear: both;
background-color: grey;
width: 100%;
height: 300px;
}
</style>
</head>
<body>
<div id="float_left">float left,不占位,可以通过clear:left清除</div>
<div id="float_right">float left,不占位,可以通过clear:right清除</div>
<div class="general"></div>
</body>
</html>
演示地址
http://xhope.top/samples/html/float.html