只利用浮动 左右浮动
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>利用浮动实现两边固定中间自适应布局</title>
<style>
html,body{
height: 100%;
margin: 0;
min-width: 800px;
}
#left{
float: left;
width: 200px;
height: 80px;
background: blue;
color: pink;
line-height: 80px;
text-align:center;
font-weight: bold;
}
#right{
float: right;
width:200px;
height: 80px;
background: blue;
color: pink;
line-height: 80px;
text-align:center;
font-weight: bold;
}
#center{
height: 80px;
margin: 0 250px;
background: pink;
color: blue;
line-height: 80px;
text-align:center;
font-weight: bold;
}
</style>
</head>
<body>
<div id="left">左左左</div>
<div id="right">右右右</div>
<div id="center">中中中</div>
</body>
</html>
只利用定位
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<