定位下拉菜单的问题

Problems with positioning a dropdown menu

我想出了一个我从来没有遇到过的问题,那就是z-index。有趣的是,我无法让 E10 Info 的下拉菜单重叠在 "container" 和 "content" div 上。我尝试了高 z-indices 但没有成功。谁能帮我解决我做错了什么? 该网站的URL是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>

如果您希望下拉菜单透明,则在下拉内容 div 上使用背景颜色 属性 而不是 z-index,只需提供 alpha(rgba 或 hsla 中的 a)值0 在下拉列表 div 上,这将使下拉列表透明。例如:- .dropdown-content { 背景颜色:rgba(90,90,90,0);}

它没有被掩盖,而是被截断了,因为您在页眉上设置了隐藏溢出。只需删除它,您就可以看到您的下拉菜单。

.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;
}