只需要把父盒子内设置为flex布局就可以了,然后子盒子设置flex1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
.father{
width: 200px;
min-height: 300px;
background-color: antiquewhite;
display: flex;
}
.son{
flex: 1;
background-color: aqua;
}
</style>
<body>
<div class="father">
<div class="son"></div>
</div>
</body>
</html>