如何让CSS导航固定在页面顶端,本来是在底部固定的

html-css014

如何让CSS导航固定在页面顶端,本来是在底部固定的,第1张

#maximg

{z-index:999background:rgba(0, 0, 0, 0.8) none repeat scroll 0 0 !important

filter:Alpha(opacity=80)background:#000width:100%height:50pxposition:fixedtop:0

_position:absolute

_background-attachment:fixed

_top:expression(eval(document.documentElement.scrollTop))

_bottom:auto}

可能我误会了你的意思,这样的话你只需把z-index改成正值999就行了,你这负值肯定会在页面下面的。

css代码

.C{ float:leftwidth:100pxheight:100pxbackground-color:red}

.D{ width:100pxheight:120pxbackground-color:green}

html代码

<div class="C"></div>

<div class="D"></div>

这个好像局限性很大,只有前面一个元素浮动了,后面一个还在文档流里的会到它下面去,也不能用z-index让它上来,因为z-index好像是对定位元素才有效果,不过反正是一个在另一个上面了,(*^__^*) 嘻嘻……