三栏布局,div左右盒子是定宽,中间是自适应

用弹性布局flex:

给父盒子加个display:flex; 给中间盒子设flex=1;

   /* 弹性盒子布局*/
.wrap{
100%;
height: 90px;
display: flex;
}
.left{
300px;
height: 90px;
background-color: red;
float: left;
}
.content{
flex:1;
height: 90px;
background-color: yellow;
}
.right{
300px;
height: 90px;
background-color:blue;
float: right;
}
</style>
</head>
<body>
<div class="wrap">
<div class="left"></div>
<div class="content"></div>
<div class="right"></div>
</div>
原文地址:https://www.cnblogs.com/zr123/p/8085697.html