两个DIV,左侧的div宽度固定,右侧DIV自适应填满剩下的宽度。
直接上代码↓
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>demo</title>
<style type="text/css">
#wrap{
padding-left: 200px;
}
.leftpart{
float:left;
width:200px;
margin-left:-200px;
height: 200px;
background-color:lightgreen;
}
.rightpart{
float: right;
width: 100%;
height: 200px;
background-color: lightseagreen;
}
</style>
</head>
<body>
<div id="wrap">
<div class="rightpart">宽度自适应部分</div>
<div class="leftpart">width200的左边栏</div>
</div>
</body>
</html>
效果如图
![](https://i-blog.csdnimg.cn/blog_migrate/95837ee1b006bdd8e553b432eb80a48c.png)