一个div靠左另一个靠右
1.使用flex布局

<style>
#back{
border: red solid 1px;
width: 800px;
height: 500px;
display: flex;
align-items: center;
}
#left{
border: blue 1px solid;
width: 100px;
height: 100px;
justify-content: flex-start;
}
#right{
border: blue 1px solid;
width: 100px;
height: 100px;
justify-content: flex-end;
flex:1;
display: flex;
}
</style>
</head>
<body>
<div id="back">
<div id="left">left</div>
<div id="right">right</div>
</div>
2.父容器使用
display: flex;
justify-content: space-between;

浙公网安备 33010602011771号