<!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>demo</title>
<style>
.content{
display: flex;
border: 1px solid #000;
}
.box{
flex:1;
border: 1px solid #000;
margin: 10px 30px;
text-align: center;
}
</style>
</head>
<body>
<div class="content">
<div class="box">
box
</div>
</div>
</body>
</html>
加position:absolute之后
.content{
position: absolute;
display: flex;
border: 1px solid #000;
}
解决方法:left:0;right:0;
.content{
position: absolute;
display: flex;
border: 1px solid #000;
left:0;
right:0;
}