常州网络公司首页 >>> WEB编程 >> DIV+CSS

css来控制div置顶置底

发布时间:2008-11-9 17:04:36   浏览次数:6762
A层和B层主要是让IE6具有position:fixed;的效果
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"  xml:lang="zh-CN" lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="zh-cn" />
<title>why?</title>
<meta name="robots" content="index, follow" />
<meta name="googlebot" content="index, follow" />
<style type="text/css" media="screen">
<!--
* {margin:0;padding:0;}
body {margin:0 auto;font:12px/20px tahoma Simsun Arial;color:#fff;background-color:#FFF;text-align:center;}
.aaa{ width:150px; background:Blue;position:absolute;left:0;top:0; }
.bbb{ width:150px; background:Blue;position:absolute;right:0;top:0; }
.ccc{ width:150px; position:absolute; top:100%;left:0; margin-top:-20px;  background:Blue;}
.ddd{ width:150px; position:absolute; top:100%;right:0; margin-top:-20px;  background:Blue;}
.aa{ width:50px; position:fixed; background:Black; _position:absolute;_top:expression(eval(document.documentElement.scrollTop));z-index:1000;left:0;top:0; }
.bb{ width:50px; position:fixed; background:Black; _position:absolute;_top:expression(eval(document.documentElement.scrollTop));z-index:1000;right:0;top:0; }
.a{ color:#000; }
  -->
</style>
</head>
<body>
<div class="aaa">AAA</div>
<div class="bbb">BBB</div>
<div class="aa">A</div>
<div class="bb">B</div>
<div class="a">
<br />
<br />
<br />
<br />
<br />
A层和B层会随滚动条移动永久置顶
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</div>
<div class="ccc">CCC</div>
<div class="ddd">DDD</div>
</body>
</html>
 
上一条:CSS+DIV实现鼠标经过背景变色
下一条:CSS列表样式属性 list-style-type
首页 | 在线留言 | 网站地图

CopyRight ©2008-2014   糊涂蛋技术网    苏ICP备05013073号
站长:万创   QQ:54960248  E-mail:xlxcn#126.com