定位下拉菜单时出现问题



我想出了一个我从未遇到过的问题,那就是z-index。有趣的是,我无法使 E10 Info 的下拉菜单在"容器"和"内容"div 上重叠。我尝试了高z指数,但没有成功。谁能帮助我做错了什么?网站的网址 http://forum.economy10.com/还有我的一些代码:

<head>
  <style>
    .dropdown {
      position: relative;
      display: inline-block;
    }
    .dropdown-content {
      display: none;
      position: absolute;
      background-color: #f9f9f9;
      min-width: 160px;
      box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
      padding: 12px 16px;
      z-index: 2000000;
      min-height:400px;
    height:400px;
    }
    .dropdown:hover .dropdown-content {
      display: block;
    }
        .dropdownd {
      position: relative;
      display: inline-block;
    }
    .dropdown-contentd {
      display: none;
      position: absolute;
      background-color: #f9f9f9;
      min-width: 160px;
      box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
      padding: 12px 16px;
      z-index: 1;
    }
    .dropdownd:hover .dropdown-contentd {
      display: block;
    }
  </style>
</head>
<div class="header">
  <div class="longo"></div>
  <a name="top" id="top"></a>
  <div class="wrapper">
    <div class="logo">
      <a href="{$mybb->settings['bburl']}/index.php"><i class="fa fa-bolt" style="color: #fcb941;"></i> {$mybb->settings['homename']}</a>
    </div>
    <!-- If you want to use Image based logo, uncomment this               <div class="logo">
 <a href="{$mybb->settings['bburl']}/index.php"><img src="{$theme['logo']}" title="{$mybb->settings['homename']}" alt="{$mybb->settings['homename']}"></a></div>    
    -->
    <ul id="menu">
      <li><a href="https://economy10.com/"> Home </a></li>
      <li><a href="http://forum.economy10.com/"> Forums </a></li>
      <li>
        <div class="dropdown">
          <a href="#" class="e10i"> E10 Info </a>
          <div class="dropdown-content">
            <ul>
              <li><a href="https://economy10.com/details/"> E10 Overview </a></li>
              <li><a href="https://economy10.com/list-of-suppliers/"> List of Suppliers </a></li>
            </ul>
          </div>
        </div>
      </li>

它没有被掩盖,它正在被切断,因为您在标题上将溢出设置为隐藏。 只需删除它,您就可以看到下拉菜单。

.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #FFFFFF;
    color: #DDD;
    z-index: 10000;
    height: 100px;
    //remove the following line
    overflow: hidden;
    -webkit-transition: height 0.3s;
    -moz-transition: height 0.3s;
    transition: height 0.3s;
    text-align: center;
    line-height: 0px;
}
如果您希望

下拉菜单是透明的,那么在下拉内容div上使用背景颜色属性而不是z-index,只需在下拉div上给出alpha(在RGBA或HSLA中(值0,它将使下拉列表透明。 例如:- .dropdown-content { background-color: rgba(90,90,90,0(;}

相关内容

  • 没有找到相关文章

最新更新