这里做出的效果是,固定中间不变,左右两边随着浏览器的变化,而变化
实现代码如下:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
#header,#content,#footer{
background-color:#ccc;
border:1px solid #00C;
height:50px;
80%;
margin:10px auto;
}
#content{
height:500px;
}
#left{
height:500px;
50%;
float:left;
margin-left:-50px;
overflow:hidden;
}
#right{
height:500px;
49.5%;
float:right;
margin-right:-50px;
overflow:hidden;
}
#cont{
height:500px;
border:1px red solid;
100px;
float:left;
background-color:#0FF;
}
#varleft{
height:500px;
border:1px solid #000;
margin-left:50px;
background-color:#F60;
}
#varright{
height:500px;
border:1px solid #000;
margin-right:50px;
background-color:#F60;
}
</style>
</head>
<body>
<div id="header"><h3>1-3-1(2)</h3></div>
<div id="content">
<div id="left">
<div id="varleft"></div>
</div>
<div id="cont">sdfsfsd</div>
<div id="right">
<div id="varright"></div>
</div>
</div>
<div id="footer"></div>
</body>
</html>