下拉子菜单不起作用

时间:2014-06-18 09:25:41

标签: html css wordpress drop-down-menu navigation

我在wordpress中使用此网站MY site并添加了子菜单菜单并添加了以下css



#navigation {
  float: left;
  width: 425px;
  margin: 0 0 0 45px;
  -webkit-transition: all 0s ease-out;
  -moz-transition: all 0s ease-out;
  -o-transition: all 0s ease-out;
  transition: all 0s ease-out;
}
#navigation ul {
  float: left;
  margin: 0;
  padding: 0;
  list-style: none;
  -webkit-transition: all 0s ease-out;
  -moz-transition: all 0s ease-out;
  -o-transition: all 0s ease-out;
  transition: all 0s ease-out;
}
#navigation ul li {
  float: left;
  position: relative;
  height: 80px;
  margin: 0 10px 0 10px;
  padding: 0;
  font-size: 12px;
  text-transform: uppercase;
  color: #838383;
  line-height: 80px;
  font-family: 'proxima-nova';
  letter-spacing: 0.33em;
  -webkit-transition: all 0s ease-out;
  -moz-transition: all 0s ease-out;
  -o-transition: all 0s ease-out;
  transition: all 0s ease-out;
  font-weight: 400;
}
#navigation ul li a {
  color: #838383;
  text-decoration: none;
  -webkit-transition: all 0s ease-out;
  -moz-transition: all 0s ease-out;
  -o-transition: all 0s ease-out;
  transition: all 0s ease-out;
}
#navigation ul li a:hover{color:#000;text-decoration:none;}
#navigation ul li ul {
  /*display: none;*/
  float: auto;
  position: absolute;
  left: 50%;
  width: 190px;
  margin-left: -95px;
  z-index: 99999;
  -webkit-box-shadow: 0px 5px 10px 1px rgba(0,0,0,0.2);
  box-shadow: 0px 5px 10px 1px rgba(0,0,0,0.2);
}
#navigation ul li ul li {
  float: left;
  width: inherit;
  background-color: #fff;
  text-align: center;
  border-bottom: 1px solid #eaeaea;
  margin: 0;
  height: auto!important;
  line-height: 1.6!important;
}
#navigation ul li ul li a {
  display: block;
  padding: 10px 0;
}
#navigation ul li ul li a:hover{color:#fff;background-color:#e7e7e7;}

<div id="navigation">

  <ul id="menu-side" class="menu"><li id="menu-item-96" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-96"><a href="#">Categories</a>
    <ul class="sub-menu">
      <li id="menu-item-101" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-101"><a href="#">Outfit</a></li>
      <li id="menu-item-102" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-102"><a href="#">Travel</a></li>
    </ul>
    </li>
    <li id="menu-item-97" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-97"><a href="#">Travels</a></li>
    <li id="menu-item-98" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-98"><a href="#">Shop</a></li>
    <li id="menu-item-99" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-99"><a href="#">About</a></li>
  </ul>   
</div>
&#13;
&#13;
&#13;

当显示时,下拉菜单不起作用,只显示而没有下拉效果。

不知道错误是什么和哪里。请帮忙!谢谢!!

更新:这是我的Fiddle

1 个答案:

答案 0 :(得分:3)

像这样更新你的课程。

 #navigation ul li ul {
 display: none;
 float: auto;
 position: absolute;
 left: 50%;
 width: 190px;
 margin-left: -95px;
 z-index: 99999;
 -webkit-box-shadow: 0px 5px 10px 1px rgba(0,0,0,0.2);
 box-shadow: 0px 5px 10px 1px rgba(0,0,0,0.2);
 }

再添加一个类,如下所示

 #navigation ul li:hover ul{display:block;}

Fiddle Demo