简体   繁体   English

Z-index不起作用

[英]Z-index not working

Take a look at this page I'm working on: http://s361608839.websitehome.co.uk/textcube/ 看一下我正在研究的这个页面: http//s361608839.websitehome.co.uk/textcube/

The nav bar is going behind the slider and I wanted it to sit above instead. 导航栏位于滑块后面,我希望它位于上方。 I've tried setting a high z-index on the #navbar and #navbar-inner and nothing happened. 我已经尝试在#navbar和#navbar-inner上设置一个高z-index,但没有任何反应。

#navbar{
background: url(../images/nav-bg.png) repeat-x;
height: 55px;
margin: 0;
padding: 0;
z-index: 9999;
}
#navbar-inner{
width: 912px;
margin: 0 auto;
position: relative;
z-index: 9999;
}

I think the javascript slider using CSS style .bx-window and .bx-window are the cause however I have set a low z-index on both, yet I don't see any difference. 我认为使用CSS样式.bx-window和.bx-window的javascript滑块是原因,但我在两者上设置了一个低z-index,但我没有看到任何区别。

Help with this would definately be appeciated. 对此的帮助肯定会被指定。

Cheers 干杯

z-index works only with positioned elements ( position:absolute , position:relative ). z-index仅适用于定位元素( position:absoluteposition:relative )。

Here's an article http://www.w3.org/TR/CSS2/visuren.html#z-index 这是一篇文章http://www.w3.org/TR/CSS2/visuren.html#z-index

In your case, you forgot to add position to one of your element. 在您的情况下,您忘记向其中一个元素添加position

它适用于float:...或position:...

添加position:relative对于#navbar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM