将一个DIV固定到顶部一个DIV固定到网页的底部中间放一个DI...
将一个DIV固定到顶部一个DIV固定到网页的底部中间放一个DIV内容超出该DIV范围可以往下拖但是上下DIV不变<style type="text/css">
body{margin:auto;}
.top{position:fixed; top:0; left:0; width:100%; height:20px; background:#933;}
.cn{height:5000px; background:#F9C; margin-top:20px;}
.foot{position:fixed; bottom:0; left:0; width:100%; height:20px; background:#933;}
</style><div class="top">
顶部固定div
</div>
<div class="cn">
内容区域<p>
内容区域<p>
内容区域<p>
内容区域<p>
内容区域<p>
内容区域<p>
内容区域<p>
内容区域<p>
内容区域<p>
内容区域<p>
内容区域<p>
</div>
<div class="foot">
底部固定div
</div>这只是测试内容高度,实际,内容区(中间的div)高度可以无限
[*]只需要将对应的顶部和底部的DIV加上样式 position:fixed; 然后顶部的
[*]顶部DIV加上css样式:top: 1px; 这个值根据自己的需要自己设置;示例代码:<div style="position:fixed; top:1px;">顶部</div>
[*]底部DIV加上css样式:bottom : 1px;这里的值也是根据需求设置;示例代码:<div style="position:fixed; bottom :1px;">顶部</div>
页:
[1]