CSS 导航栏下拉菜单在 Chrome 中不起作用



我有一个博客,它有一个带下拉功能的导航栏。然而,我没有得到下拉列表下的项目"硒"在Chrome中,但下拉在其他浏览器中工作良好

遗憾的是,我不明白问题出在哪里。

我有一个导航栏与以下html:

<nav id="menu-bar">
<ul>
  <li><a href='http://sunilpatro1985.blogspot.in/' >Home</a></li>
 <li><a href='http://sunilpatro1985.blogspot.in/search/label/SeleniumTesting'>Selenium</a>
    <ul>
     <li><a href='http://sunilpatro1985.blogspot.in/2015/04/selenium-testng.html'>TestNG</a></li>
 <li><a href='http://sunilpatro1985.blogspot.com/2015/03/selenium-result-report-testng-ant.html'>ANT Reporting</a></li>
    </ul>
  </li>
 <li><a href='http://sunilpatro1985.blogspot.in/search/label/SoftwareTesting'>TestingConcepts</a></li>
 <li><a href='http://sunilpatro1985.blogspot.in/search/label/BasicJava' >JavaBasics</a></li>
  <li><a href='http://sunilpatro1985.blogspot.in/search/label/WindowsOS' >Windows</a></li>
<li><a href='http://sunilpatro1985.blogspot.in/p/demo.html' >Demo</a></li>
</ul></nav>

的CSS样式是:

#menu-bar {position: fixed; top: 0px; left: 330px; z-index: 999;height:0px;}
#menu-bar,#menu-bar a  {
  text-align: center;
  margin: 0px 0px;
border:none;
}
#menu-bar ul ul {
  display: none;
}
#menu-bar ul li:hover > ul {
  display: block;
}
#menu-bar ul {
  background: #efefef; 
  background: linear-gradient(top, #efefef 0%, #bbbbbb 100%);  
  background: -moz-linear-gradient(top, #efefef 0%, #bbbbbb 100%); 
  background: -webkit-linear-gradient(top, #efefef 0%,#bbbbbb 100%); 
  box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
  padding: 0 20px;
  border-radius: 7px;  
  list-style: none;
  position: relative;
  display: inline-table;
}
#menu-bar ul:after {
    content: ""; clear: both; display: block;
  }
#menu-bar ul li {
  float: left;
}
#menu-bar ul li:hover {
    background: #4b545f;
    background: linear-gradient(top, #4f5964 0%, #5f6975 40%);
    background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
    background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
  }
#menu-bar ul li:hover a {
      color: #fff;
    }
#menu-bar ul li a {
    display: block; padding: 15px 30px;
    color: #757575; text-decoration: none;
  }
#menu-bar ul ul {
  background: #5f6975; border-radius: 0px; padding: 0;
  position: absolute; top: 100%;
}
#menu-bar ul ul li {
    float: none; 
    border-top: 1px solid #6b727c;
    border-bottom: 1px solid #575f6a;
    position: relative;
  }
#menu-bar ul ul li a {
      padding: 15px 30px;
      color: #fff;
    }
#menu-bar ul ul li a:hover {
        background: #4b545f;
      }
#menu-bar ul ul ul {
  position: absolute; left: 100%; top:0;
}

menu-bar中,您有ul。将style="overflow: visible;"添加到ul,这将修复它。

你必须把overflow:visible;添加到你的menu-bar->ul元素

#menu-bar ul {
    overflow:visible;
}
固定css

#menu-bar {position: fixed; top: 0px; left: 330px; z-index: 999;height:0px;}
#menu-bar,#menu-bar a  {
  text-align: center;
  margin: 0px 0px;
border:none;
}
#menu-bar ul ul {
  display: none;
}
#menu-bar ul li:hover > ul {
  display: block;
}
#menu-bar ul {
  background: #efefef; 
  background: linear-gradient(top, #efefef 0%, #bbbbbb 100%);  
  background: -moz-linear-gradient(top, #efefef 0%, #bbbbbb 100%); 
  background: -webkit-linear-gradient(top, #efefef 0%,#bbbbbb 100%); 
  box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
  padding: 0 20px;
  border-radius: 7px;  
  list-style: none;
  position: relative;
  display: inline-table;
  overflow:visible;
}
#menu-bar ul:after {
    content: ""; clear: both; display: block;
  }
#menu-bar ul li {
  float: left;
}
#menu-bar ul li:hover {
    background: #4b545f;
    background: linear-gradient(top, #4f5964 0%, #5f6975 40%);
    background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
    background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
  }
#menu-bar ul li:hover a {
      color: #fff;
    }
#menu-bar ul li a {
    display: block; padding: 15px 30px;
    color: #757575; text-decoration: none;
  }
#menu-bar ul ul {
  background: #5f6975; border-radius: 0px; padding: 0;
  position: absolute; top: 100%;
}
#menu-bar ul ul li {
    float: none; 
    border-top: 1px solid #6b727c;
    border-bottom: 1px solid #575f6a;
    position: relative;
  }
#menu-bar ul ul li a {
      padding: 15px 30px;
      color: #fff;
    }
#menu-bar ul ul li a:hover {
        background: #4b545f;
      }
#menu-bar ul ul ul {
  position: absolute; left: 100%; top:0;
}

相关内容

  • 没有找到相关文章

最新更新