固定div在指定位置兼容寫法


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無閃動的div層固定</title>
<style type="text/css">
body{margin:0px; padding:0px;}
#fixedBottom{
position:fixed; bottom:100px; 
_position:absolute; _bottom:100px;
_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginBottom,10)||100)));
width:100%; height:30px; line-height:30px; border:1px solid #ccc;
}
#fixedTop{
position:fixed; top:0px; 
_position:absolute; _top:100px;
_top:expression(eval(document.documentElement.scrollTop+(parseInt(this.currentStyle.marginTop,10)||100)));
width:100%; height:30px; line-height:30px; border:1px solid #ccc;
}
*html{background-image:url(about:blank);background-attachment:fixed;}
</style>
</head>
<body style="height:2000px;">

<div id="fixedTop">我吃了定心丹,風吹不動,雷打不動,我就定在這愁着你!</div> 

<div id="fixedBottom">我吃了定心丹,風吹不動,雷打不動,我就定在這愁着你!</div>

</body>
</html>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM