flex布局
<!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>Document</title>
<style>
.div0 {
width: 500px;
background: green;
display: flex;
flex-direction: row;
}
.div0 div {
width: 100px;
height: 100px;
background-color: yellow;
}
</style>
</head>
<body>
<div class="div0">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div>
</body>
</html>
float布局
<body>
<div style="background: red; width: 400px;">
<span style="background: green; float: left; width: 200px; height: 50px;">
float
</span>
<span style="background: green; float: left; width: 200px; height: 50px;">
float
</span>
<span>写几个字</span>
</div>
</body>