div块始终在顶部且不被覆盖 div块始终在顶部且不被覆盖,就像新版微博顶部的导航条一样?急呀! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <body style="z-index:0;background:#ff0;width:100%;height:1000px;"><div style="position:fixed;width:100%;height:200px;display:block;background:#f00;z-index:1000;top:0;left:0">顶部</div><div style="float:left;width:100%;height:200px;display:block;background:#15c;padding-top:800px;">底部</div></body> <!doctype html><html dir="ltr" lang="zh-CN"> <head> <meta charset="utf-8"/> <title>CSS Position Fixed for IE6</title> <style>* html,* html body {background-image:url(about:blank);background-attachment:fixed;}* html .fixed-top {position:absolute;bottom:auto; top:expression(eval(document.documentElement.scrollTop +(document.documentElement.clientHeight-this.offsetHeight)/2 ));}* html .fixed-right {position:absolute;right:0px;left:auto;}* html .fixed-bottom {position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));}* html .fixed-left {position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft));}.fixed-bottom { position:fixed; left:0px; bottom:20px; background:aqua; width:200px; height:200px;}.fixed-right{ position:fixed; right:0px; left:auto; top:200px; top:expression(eval(document.documentElement.scrollTop +(document.documentElement.clientHeight-this.offsetHeight)/2 )); background:red; width:200px; height:200px;}.fixed-top{ position:fixed; top:0px; left:0px; background:blue; width:200px; height:200px;} </style> </head> <body> <div style='height:2000px;width:500px;margin:10px auto; border:1px solid red;'></div> <div class="fixed-top"></div> <div class="fixed-bottom"></div> <div class="fixed-right"></div> </body></html> 对,给你的元素或者div 加上z-index。。想放在最上面的z-index:5;值大一点希望被覆盖的z-index:4;小一点即可 最主要的是position和z-index吧,我把#top这个div设置成:position:absolute;z-index:1;top:0px;还是没有效果啊。 .myAlbumMain_pop_control_btnCancel_boreder{ opacity:1.5;/*FF*/ //半透明样式 z-index:1000000; //最顶端 position:fixed!important; //跟随滚动条走,怎么晃都不动,下面都是,真对IE各种版本 position:absolute;/*IE6*/ _top:expression(eval(document.compatMode && document.compatMode=='CSS1Compat') ? documentElement.scrollTop + (document.documentElement.clientHeight-this.offsetHeight)/2 :/*IE6*/ document.body.scrollTop + (document.body.clientHeight - this.clientHeight)/2);/*IE5 IE5.5*/} 这个positio:fixed!important;有用,谢谢了!谢谢大家! 用JS如何做QQ空间留言代码的特效 包含库文件 ajax串行化 JS中字符怎么加空格 onclick事件,改<a href="#">的样式 请问,javascript怎么隐藏一个<a></a>标记?谢谢 Java Applet 怎么实现Web实时通讯 请教类似新浪邮箱中提示对话框出现时背景变暗的实现方法 怎样把二个文本框的数据相减? 启动myeclipse 中的web项目看不了,报错404错误 js中遇到的特殊语法(&& || !! 的使用方式),请高手指点 firefox下如何控制超链接不能点击
<div style="position:fixed;width:100%;height:200px;display:block;background:#f00;z-index:1000;top:0;left:0">
顶部
</div>
<div style="float:left;width:100%;height:200px;display:block;background:#15c;padding-top:800px;">
底部
</div>
</body>
<!doctype html>
<html dir="ltr" lang="zh-CN">
<head>
<meta charset="utf-8"/>
<title>CSS Position Fixed for IE6</title>
<style>
* html,* html body {background-image:url(about:blank);background-attachment:fixed;}
* html .fixed-top {position:absolute;bottom:auto; top:expression(eval(document.documentElement.scrollTop +(document.documentElement.clientHeight-this.offsetHeight)/2 ));}
* html .fixed-right {position:absolute;right:0px;left:auto;}
* html .fixed-bottom {position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));}
* html .fixed-left {position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft));}
.fixed-bottom {
position:fixed;
left:0px;
bottom:20px;
background:aqua;
width:200px;
height:200px;
}
.fixed-right{
position:fixed;
right:0px;
left:auto;
top:200px;
top:expression(eval(document.documentElement.scrollTop +(document.documentElement.clientHeight-this.offsetHeight)/2 ));
background:red;
width:200px;
height:200px;
}
.fixed-top{
position:fixed;
top:0px;
left:0px;
background:blue;
width:200px;
height:200px;
}
</style> </head>
<body>
<div style='height:2000px;width:500px;margin:10px auto; border:1px solid red;'></div>
<div class="fixed-top"></div>
<div class="fixed-bottom"></div>
<div class="fixed-right"></div>
</body>
</html>
还是没有效果啊。
.myAlbumMain_pop_control_btnCancel_boreder
{
opacity:1.5;/*FF*/ //半透明样式
z-index:1000000; //最顶端
position:fixed!important; //跟随滚动条走,怎么晃都不动,下面都是,真对IE各种版本
position:absolute;/*IE6*/
_top:expression(eval(document.compatMode &&
document.compatMode=='CSS1Compat') ?
documentElement.scrollTop + (document.documentElement.clientHeight-this.offsetHeight)/2 :/*IE6*/
document.body.scrollTop + (document.body.clientHeight - this.clientHeight)/2);/*IE5 IE5.5*/
}
有用,谢谢了!谢谢大家!