在父容器content写了第一个属性
1、display:flex:
代码和效果如图所示,默认横向布局
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>flex布局</title>
<style>
.content {
display: flex;
}
.children {
width: 100px;
height: 100px;
margin-right: 20px;
background: rebeccapurple;
}
</style>
</head>
<body>
<div class="content">
<div class="children"></div>
<div class="children"></div>
<div class="children"></div>
</div>
</body>
</html>
给父容器增加第二个属性:
2、flex-direction方向属性
默认方向属性:
(1)row