【发布时间】:2013-12-16 16:10:46
【问题描述】:
我已经尝试了所有可以在 Google 上找到的解决方案,但不知何故,关于 z-index 的所有信息都不起作用 :(。这是我第一次使用这个网站,如果我的内容看起来很乱,请见谅.
问题1:https://www.dropbox.com/s/jr5wew27ydv7hcl/Screen%20Shot%202013-12-16%20at%2011.57.01%20pm.png
问题2:https://www.dropbox.com/s/7ffztfq7iezc4ao/Screen%20Shot%202013-12-16%20at%2011.57.50%20pm.png
我自己的 CSS 表格
.header{
width:960px;
height:99px;
font-family:'Francois One', sans-serif;
text-transform:uppercase;
z-index:9999px;}
<!--this holds the css menu bar-->
.banner, #slidermain {
width:960px;
height:328px;}
<!--this holds the nivo slider-->
.slidermain {
background-color:#399;
margin-bottom:10px;}
Nivo 滑块 CSS 表
/* The Nivo Slider styles */
.nivoSlider {
position:relative;
width:100%;
height:auto;
overflow: hidden;
float:left;
z-index:10px;
}
.nivoSlider img {
position: relative;
top:0px;
left:0px;
max-width: none;
}
.nivo-main-image {
display: block !important;
position: relative !important;
width: 100% !important;
}
如果 css 菜单位置设置为相对,它会起作用,但下拉菜单会向下推动 nivo 滑块以适应其大小,从而导致其他表格也向下移动。但是一旦鼠标离开菜单栏,nivo 滑块就会调整到原来的位置。
/* user menu settings */
.ddmenu {
display: block;
padding:5px;
text-align:center;
width: 110px;
margin: 0 auto;
margin-top:45px;
position: relative;
cursor: pointer;
background: #fff;
font-size: 1.2em;
color: #656565;
font-weight: normal;
float: left;
-webkit-box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
-moz-box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
-webkit-transition: all 0.15s linear;
-moz-transition: all 0.15s linear;
-ms-transition: all 0.15s linear;
-o-transition: all 0.15s linear;
transition: all 0.15s linear;
}
.ddmenu:hover { color: #898989; }
.ddmenu.open {
background: #5a90e0;
color: #fff;
border-left-color: #6c6d70;
position:relative;
z-index:200px;
}
.ddmenu ul {
position: relative;
top: 100%;
left: -1px; /* move content -1px because of container left border */
width: 200px;
z-index:200px;
padding: 10px;
display: none;
border-left: 4px solid #8e9196;
background: #fff;
list-style:none;
text-decoration:none;
text-align:left;
-webkit-box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
-moz-box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}
非常感谢您提供的任何帮助!谢谢!
【问题讨论】:
-
这不对,
z-index:200px;,你不给它分配像素大小只是200。此外,不是 100% 确定,如果 css 在它自己的样式表上,你不应该像这样使用 html cmets,<!--this holds the nivo slider-->,如果是,则使用/* Comment goes here */。
标签: javascript jquery html css