主体位于所有元素的最前面,使所有元素均不可点击

时间:2019-02-14 18:34:12

标签: html css

这可能真的很愚蠢,但我的身体覆盖了所有元素,使所有内容无法点击...我之前已修复此问题,但我忘记了如何做。

https://codepen.io/Tehan123/pen/VgdRBQ

`<body>
  <section class="Body-Wrapper">
  <div class="Page-Wrapper-First">


          <img class="logo" src="https://image.flaticon.com/icons/png/512/776/776541.png"</img>

    <nav>
        <ul class="nav-menu">
       <li><a href="#">Features </a> </li>
       <li><a href="#">How It Works </a> </li>
       <li><a href="#">Pricing </a> </li>
       </ul>
      <div class="dropdown">
  <button class="menu" src="https://image.flaticon.com/icons/svg/149/149176.svg"> </button>
  <div class="dropdown-content">
    <a href="#">Features</a>
    <a href="#">How It Works</a>
    <a href="#">Pricing</a>

    </nav>
      <section class="hero">
        <div class="hero-text">
          <h1> Creates 'a place beyond time' for its guests.</h1>
        </div>
      <img class="hero-image" src="https://images.pexels.com/photos/1320686/pexels-photo-1320686.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260"</img>
      </section>
    </div>
   </section>
    </body

>     `

1 个答案:

答案 0 :(得分:4)

您的身体上的z-index为负。每当元素的z索引为负时,它们都是不可单击的,并且作为子实体的所有元素都将相同。您需要设置一个大于0的值。

这是CSS的最后3行

body {
  z-index: -3;
}

更新

似乎您在z-index: -2上有一个.Body-Wrapper。您应该使用大于0的值。

当您删除/更改这两个值时,页面看起来好像坏了,这是因为在其他位置有一堆负的z-index值。您还需要将其更改为正数。