【问题标题】:CSS menu hide behind Nivo Slider's navigator in Adobe DreamweaverCSS 菜单隐藏在 Adob​​e Dreamweaver 中 Nivo Slider 的导航器后面
【发布时间】:2016-02-13 21:10:39
【问题描述】:

CSS 菜单隐藏在 Adob​​e Dreamweaver 中 Nivo Slider 的导航器后面。我尝试对菜单第一级使用相对位置,并为菜单 2 级添加绝对位置,但对我不起作用。

NIVO 滑块:

.theme-orman .nivo-controlNav-bg {
    position:absolute;
    left: 0;
    bottom: -15px;
    width: 960px;
    height: 44px;
    z-index: 100;
    background: url(../images/slider_nav_bg.png) no-repeat  
}

.theme-orman .nivo-controlNav {
    position:absolute;
    left: 472px;
    bottom: 4px;
    margin-left:-30px; /* Tweak this to center bullets */
    z-index: 101;
}
.theme-orman .nivo-controlNav a {
    display:block;
    width:12px;
    height:12px;
    background:url(../images/slider_nav_button.png) no-repeat;
    text-indent:-9999px;
    border:0;
    margin-right:7px;
    float:left;
}

CSS 菜单:

    .ddsmoothmenu{
}

.ddsmoothmenu ul{
    z-index:100;
    margin: 0;
    padding: 0;
    list-style-type: none;
}

/*Top level list items*/
.ddsmoothmenu ul li{
    position: relative;
    display: inline;
    float: left;
}

/*Top level menu link items style*/
.ddsmoothmenu ul li a {
    display: block;
    height: 46px;
    width: 106px;
    margin-right: 5px;
    line-height: 35px;
    padding-top: 10px;
    font-size: 13px;
    color: #FCFCC7; 
    text-align: center;
    text-decoration: none;
    font-weight: 400;
    outline: none;
    background: url(../images/templatemo_menu_item.jpg) 
}

* html .ddsmoothmenu ul li a{ /*IE6 hack to get sub menu links to behave       correctly*/
display: inline-block;
}

.ddsmoothmenu ul li a.selected, .ddsmoothmenu ul li a:hover { /*CSS class     that's dynamically added to the currently active menu items' LI A element*/
    color: #EB1765;
    background: url(../images/templatemo_menu_hover2.png) no-repeat
}

/*1st sub level menu*/
.ddsmoothmenu ul li ul {
    position: absolute;
    width: 184px;
    margin: 0 0 0 3px;
    display: none; /*collapse all sub menus to begin with*/
    visibility: hidden;
    background: #F0E11A
}

/*Sub level menu list items (undo style from Top level List Items)*/
.ddsmoothmenu ul li ul li{  
display: list-item;
float: none;
}

/*All subsequent sub menu levels vertical offset after 1st level sub menu */
.ddsmoothmenu ul li ul li ul{
top: 0;
}

/* Sub level menu links style */
.ddsmoothmenu ul li ul li a{
    font-weight: 500;
    width: 140px; /*width of sub menus*/
    margin: 0 3px 0 1px;
    height: 28px;
    line-height: 28px;
    padding: 5px 22px;
    font-size: 11px;
    text-align: left;
    background: none;
    color: #161AF7;
    border-bottom: 1px solid #bab5b0

}

.ddsmoothmenu ul li ul li .last {
    border-bottom: none;
}

.ddsmoothmenu ul li ul li a.selected, .ddsmoothmenu ul li ul li a:hover {
    color: #EDEA15;
    width: 139px;
    padding-left: 25px;
    background: #CF178E;
}


/* Holly Hack for IE \*/
* html .ddsmoothmenu{height: 1%;} /*Holly Hack for IE7 and below*/


/* ######### CSS classes applied to down and right arrow images  #########  */

.downarrowclass{
position: absolute;
top: 12px;
right: 7px;
}

.rightarrowclass{
position: absolute;
top: 6px;
right: 5px;
}

/* ######### CSS for shadow added to sub menus  ######### */

.ddshadow{
position: absolute;
: 0;
top: 0;
width: 0;
height: 0;
}

.toplevelshadow{ /*shadow opacity. Doesn't work in IE*/
opacity: 0.5;
}

/* menu */

【问题讨论】:

  • z-index 低于滑块控件
  • @charlietfl 我已更改 z-index 但不适用于菜单。
  • 创建一个复制问题的演示
  • @charlietfl z-index 适用于滑块导航背景和滑块导航按钮,不适用于菜单 ul{ 。如何创建演示?
  • 任何沙盒网站,如 jsfiddle.net、plunkr.co、codepen.io 等。有很多选择。使用 cdn 包含所需资源

标签: jquery css drop-down-menu dreamweaver


【解决方案1】:
.ddsmoothmenu ul{
    position: relative; /* add a position */
    z-index:102; /* changed from 100 */
    margin: 0;
    padding: 0;
    list-style-type: none;
}

z-index 是屏幕上的关卡。点有 100,菜单有 100。所以它会画在点的后面。所以你只需要改变关卡。

【讨论】:

  • 我已更改 z-index 但不适用于菜单。
  • 现在问题通过添加相对于第一级菜单的位置来解决 .ddsmoothmenu ul{ position: relative; /* 添加一个位置 / margin: 0;填充:0;列表样式类型:无; z-索引:102; / 从 100 更改 */ }
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-07-24
  • 2018-04-14
  • 1970-01-01
  • 2017-09-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多