1只会影响后面得元素
<!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>float浮动</title><style>body{border:1px solid red}#box1{width: 100px;height: 100px;background: yellow;}#box2{width: 200px;height: 200px;background: red;float: left;}#box3{width: 300px;height: 300px;background: black;}</style>
</head>
<body><div id="box1"></div><div id="box2"></div><div id="box3"></div>
</body>
</html>
运行结果
内容保存为两层
<!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>float浮动</title><style>body{border:1px solid red}#box1{width: 100px;height: 100px;background: yellow;}#box2{width: 200px;height: 200px;background: red;float: left;}#box3{width: 300px;height: 300px;background: black;}</style>
</head>
<body><div id="box1"></div><div id="box2"></div><div id="box3">文字文字文字文字文字文字文字</div>
</body>
</html>
运行结果
默认宽根据内容决定
换行排序