<!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>
.container {
width: 400px;
height: 200px;
background-color: aquamarine;
border: 1px aquamarine dotted;
}
.display-flex {
display: flex;
}
.flex-item {
border: 1px #000 solid;
background-color: #d44468;
flex: 1;
}
</style>
</head>
<body>
<div class="container display-flex">
<div class="flex-item ">1</div>
<div class="flex-item ">2</div>
<div class="flex-item ">3</div>
</div>
</body>
</html>
父级标签设置:display: flex;
子级标签设置:flex: 1;