<!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>Document</title>
<style>
section {
width: 1000px;
height: 200px;
border:1px solid pink;
margin:100px auto;
display:flex;
}
section div {
/* width:33.33%; */
height:100%;
float:left;
/* flex:1; */
margin:0 5px;
/* 子盒子添加份数 */
}
section div:nth-child(1) {
background-color: pink;
width: 300px;
/* 子盒子份数 不跟单位*/
}
section div:nth-child(2) {
background-color: green;
width: 100px;
}
section div:nth-child(3) {
background-color: pink;
flex:1;
}
section div:nth-child(4) {
background-color: skyblue;
flex:1;
}
</style>
</head>
<body>
<section>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</section>
</body>
</html>
2个盒子固定 不影响剩下的盒子,剩下的盒子再去平均分
伸缩时固定像素的盒子不变