| 導購 | 订阅 | 在线投稿
分享
 
 
 

css控制div置頂置底的例子

來源:互聯網  2008-08-08 06:10:27  評論

<!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" />
http://www.w3css.com/allnews.asp?id=990

<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 /><br /><br /><br /><br /><br /><br />

<br /><br /><br /><br /><br /><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>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[url=http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/url]"> <html xmlns="[url=http://www.w3.org/1999/xhtml]http://www.w3.org/1999/xhtml[/url]" 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" /> [url=http://www.w3css.com/allnews.asp?id=990]http://www.w3css.com/allnews.asp?id=990[/url] <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 /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><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>
󰈣󰈤
王朝萬家燈火計劃
期待原創作者加盟
 
 
 
>>返回首頁<<
 
 
 
 
 熱帖排行
 
 
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有