方法一:浮动 注意三个div的位置
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
*{
margin:0;
padding:0;
}
.left{
100px;
background-color: red;
height:100%;
float:left;
}
.middle{
auto;
height:100%;
background-color: yellow;
}
.right{
100px;
background-color: blue;
float:right;
height:100%;
}
</style>
</head>
<body>
<div id="id">
<div class="left"></div>
<div class="right"></div>
<div class="middle"></div>
</div>
</body>
</html>
方法二:定位
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
*{
margin:0;
padding:0;
}
#id{
position: relative;
}
.left{
100px;
background-color: red;
height:100%;
position: absolute;
top:0;
left:0;
}
.middle{
auto;
height:100%;
background-color: yellow;
margin:0 100px;
}
.right{
100px;
background-color: blue;
height:100%;
position: absolute;
top:0;
right:0;
}
</style>
</head>
<body>
<div id="id">
<div class="left"></div>
<div class="middle"></div>
<div class="right"></div>
</div>
</body>
</html>