<!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>三栏布局</title>
<style>
*{
margin: 0px;
padding: 0px;
}
html,body{
height: 100%;
}
.left,.right{
width: 200px;
height: 100%;
}
.left{
background: red;
float: left;
}
.right{
background: yellow;
float: right;
}
.center{
height: 100%;
background: blue;
}
</style>
</head>
<body>
<div class="left"></div>
<div class="right"></div>
<div class="center"></div>
</body>
</html>
<!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>三栏布局</title>
<style>
*{
margin: 0px;
padding: 0px;
}
html,body{
height: 100%;
}
.left,.right{
width: 200px;
height: 100%;
}
.left{
background: red;
float: left;
}
.right{
background: yellow;
float: right;
}
.center{
width: calc(100% - 400px);
/*注意calc函数值之间留空格*/
height: 100%;
background: blue;
float: left;
}
</style>
</head>
<body>
<div class="left"></div>
<div class="right"></div>
<div class="center"></div>
</body>
</html>