固定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