先看效果图:
html代码:
<!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>
.box{
height: 100px;
width: 100%;
border: 1px solid red;
margin: 50px auto;
display: flex;
justify-content: space-between;
align-items: center;
}
.left{
flex: 1;
height: 50px;
width:80%;
background-color: aqua;
}
.right{
margin-left: 200px;
width: 25%;
height: 50px;
background-color: pink;
}
</style>
</head>
<body>
<div class="box">
<div class="left"></div>
<div class="right"></div>
</div>
</body>
</html>