html - 宽度为 100% 的 Div 阻止我点击另一个 div

标签 html css

我的问题是我无法在 div <div class="navbar logo right"> 上单击或触发悬停事件这显然落后于<div class="navbar nav-tabs middle"> .每当我按下注销并在我将鼠标悬停在图像上(导航菜单的右侧)时更改图像上的边框颜色时,网站应该会重定向我。

每次我右键单击 > 检查图像上的元素或注销文本时,它会自动选择另一个 div。

查看并运行下面的代码,这样它对您来说会更有意义。

html {
  height: auto;
}

.main {
  height: 100%;
}

.navbar {
  line-height: 55px !important;
  height: 55px !important;
  max-height: 55px !important;
}

.middle {
  position: absolute;
  width: 100%;
  left: 0;
  text-align: center;
  margin: 0 auto;
}

.navigation {
  z-index: 1000;
  display: block;
  height: 55px !important;
  width: 100%;
}

body {
  height: 100%;
  background-color: #1d1d1d;
  margin: 0;
  -webkit-font-smoothing: subpixel-antialiased;
}

.bg-dark {
  background-color: #232323 !important;
  color: white;
}

.nav-tabs > a {
  display: inline-block;
  font-size: 18px;
  color: white;
  padding: 0 1.5%;
  transition: background-color 0.2s;
  transition: color 0.2s;
}

.nav-tabs > a:hover {
  color: #ffb300 !important;
    background-color: #313131;
    cursor: pointer;
}
.nav {
height: 55px !important;
line-height: 55px;
max-height: 55px;
padding: 0px 40px;
color: white;
}

.no-margin {
  margin: 0;
}

.nav-container {
  width: 100%;
  height: 100%;
  padding: 0 5%;
}

.content {
  height: calc(100% - 55px);
  max-height: calc(100% - 55px);
}

.main > img {
  z-index: -1000;
  position: fixed;
  opacity: 0.75;
}

.shop {
  -webkit-box-pack: start;
    -webkit-justify-content: flex-start;
    -ms-flex-pack: start;
    justify-content: flex-start;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
}

.shop-container {
  -webkit-box-align: start;
-webkit-align-items: flex-start;
-ms-flex-align: start;
align-items: flex-start;
display: -webkit-box;
   display: -webkit-flex;
   display: -ms-flexbox;
   display: flex;
   width: 100%;
   max-width: 1600px;
   -webkit-box-orient: vertical;
   -webkit-box-direction: normal;
   -webkit-flex-direction: column;
   -ms-flex-direction: column;
   flex-direction: column;
   -webkit-box-pack: center;
   -webkit-justify-content: center;
   -ms-flex-pack: center;
   justify-content: center;
   -webkit-box-align: center;
   -webkit-align-items: center;
   -ms-flex-align: center;
   align-items: center;
}

.items-wrapper {
  display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    margin-right: -4px;
    margin-left: -4px;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -webkit-flex-direction: row;
    -ms-flex-direction: row;
    flex-direction: row;
    -webkit-box-pack: start;
    -webkit-justify-content: flex-start;
    -ms-flex-pack: start;
    justify-content: flex-start;
    -webkit-flex-wrap: wrap;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-align: stretch;
    -webkit-align-items: stretch;
    -ms-flex-align: stretch;
    align-items: stretch;
    -webkit-align-content: stretch;
    -ms-flex-line-pack: stretch;
    align-content: stretch;
}

.item-wrapper {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    max-width: 25%;
    min-width: 182px;
    padding: 4px;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -webkit-flex-direction: row;
    -ms-flex-direction: row;
    flex-direction: row;
    -webkit-box-pack: start;
    -webkit-justify-content: flex-start;
    -ms-flex-pack: start;
    justify-content: flex-start;
    -webkit-flex-wrap: nowrap;
    -ms-flex-wrap: nowrap;
    flex-wrap: nowrap;
    -webkit-box-align: stretch;
    -webkit-align-items: stretch;
    -ms-flex-align: stretch;
    align-items: stretch;
    -webkit-align-content: flex-end;
    -ms-flex-line-pack: end;
    align-content: flex-end;
    -webkit-box-flex: 13px;
    -webkit-flex: 13px;
    -ms-flex: 13px;
    flex: 13px;
    max-height: 261px;
}

.card {
    transition: background-color 0.5s;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    width: 100%;
    height: 100%;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
    border-style: none;
    border-width: 1px;
    border-color: rgba(0, 0, 0, .06);
    border-radius: 3px;
    background-color: #2a2a2a !important;
    color: #f3f3f3;
    text-align: center;
    text-decoration: none;
}

.item-image-wrapper {
    position: relative;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    width: 100%;
    padding: 30px 26px 18px 25px;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
    background-color: hsla(0, 0%, 100%, 0);
}

.item-image {
    display: block;
    height: auto;
    max-width: 120px;
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
}

img {
    max-width: 100%;
    vertical-align: middle;
    display: inline-block;
}

.price-tag-wrapper.with-line {
    position: static;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -webkit-flex-direction: row;
    -ms-flex-direction: row;
    flex-direction: row;
    background-image: none;
    background-position: 0px 0px;
    background-size: auto;
    background-repeat: repeat;
}

.price-tag-wrapper {
    position: relative;
    display: block;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
}

.item-info-wrapper {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    width: 100%;
    max-height: 90px;
    min-height: 90px;
    padding: 2px 10px 6px;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-flex-wrap: nowrap;
    -ms-flex-wrap: nowrap;
    flex-wrap: nowrap;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-align-content: center;
    -ms-flex-line-pack: center;
    align-content: center;
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    -ms-flex: 1;
    flex: 1;
}

.price-tag.with-line {
    box-shadow: none;
    letter-spacing: 0px;
}

.price-tag {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    padding: 3px 10px 2px;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    border-radius: 2px;
    background-color: #fff;
    box-shadow: none;
    font-family: Lato, sans-serif;
    color: #000;
    font-size: 14px;
    font-weight: 900;
    text-align: center;
    text-transform: none;
}

.item-name {
    max-width: 100%;
    font-family: Lato, sans-serif;
    color: #fff;
    font-size: 19px;
    line-height: 24px;
    font-weight: 700;
    text-transform: none;
}

.condition {
    margin-top: 2px;
    margin-bottom: 2px;
    color: #fff;
    font-size: 16px;
    font-weight: 300;
}

h4 {
    margin-top: 0px;
    margin-bottom: 0px;
    font-family: Montserrat, sans-serif;
    color: #fff;
    font-weight: 500;
    letter-spacing: 0.5px;
}

@media (max-width: 991px) {
.item-wrapper {
    min-width: 152px;
    padding: 4px;
    -webkit-flex-basis: 25%;
    -ms-flex-preferred-size: 25%;
    flex-basis: 25%;
  }
}

@media (max-width: 767px) {
.item-wrapper {
    max-width: 50%;
    min-width: 180px;
    -webkit-flex-basis: 33.3%;
    -ms-flex-preferred-size: 33.3%;
    flex-basis: 33.3%;
}
}

@media (max-width: 479px) {
.item-wrapper {
    max-width: 100%;
    -webkit-box-pack: start;
    -webkit-justify-content: flex-start;
    -ms-flex-pack: start;
    justify-content: flex-start;
    -webkit-box-flex: 1;
    -webkit-flex-grow: 1;
    -ms-flex-positive: 1;
    flex-grow: 1;
    -webkit-flex-basis: 50%;
    -ms-flex-preferred-size: 50%;
    flex-basis: 50%;
}
}

.card:hover {
  background-color: #313131 !important;
  -webkit-transform: none;
  -ms-transform: none;
  transform: none;
  transition: border 0.5s;
}

.responsive-img {
  display: inline-block;
  vertical-align: middle;
  border-radius: 70px;
  border: 2px solid #3b3b3b;
  line-height: 55px;
  transition: border-color 0.2s;
}

.logout {
  display: inline-block;
  margin-left: 10px;
  cursor: pointer;
  color: white;
}

.responsive-img:hover {
  border-width: 2px;
  border-style: solid;
  border-color: #ffb300;
  cursor: pointer;
}

.nav-link {
  max-width: 1600px;
    padding: 18.5px;
    color: white;
    transition: background-color 0.1s;
    transition: color 0.2s;
}

.nav-link:hover {
  color: #ffb300 !important;
  background-color: #313131;
  cursor: pointer;
}

.footer {
  border
  background-color: #2a2a2a !important;
}
<!DOCTYPE html>
<html>
  <head>
    <title>Sale</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
    <link href="https://fonts.googleapis.com/css?family=Lato:400,900" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/css/materialize.min.css">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
  </head>
  <body>
    <div class="main">
      <div class="header">
        <div class="navigation bg-dark">
          <div class="nav-container">
          <div class="navbar logo left">
            <h4 class="navbar no-margin">Logo</h4>
          </div>
          <div class="navbar nav-tabs middle">
            <a class="navbar no-margin">SHOP</a>
            <a class="navbar no-margin">TUTORIAL</a>
            <a class="navbar no-margin">SELL</a>
            <a class="navbar no-margin">ABOUT US</a>
          </div>
          <div class="navbar logo right">
            <img class='responsive-img' src='https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/35/35c35c9020dffeaab3711e05afd2bdd9455d3f39.jpg'/><a href='../logout.php' class='no-margin logout'>Logout</a>          </div>
        </div>
      </div>
      </div>
      <div class="content">
      <div class="shop">
        <div class="shop-container">
          <div id="items-wrapper" class="items-wrapper">
          </div>
        </div>
      </div>
    </div>
    </div>
  </body>
  </html>

最佳答案

您可以向元素添加 z-index 以使其位于上方并可点击,如下所示:

.logo {
    position: relative;
    z-index: 99;
}

完整代码:

html {
  height: auto;
}

.main {
  height: 100%;
}

.navbar {
  line-height: 55px !important;
  height: 55px !important;
  max-height: 55px !important;
}

.logo {
  position: relative;
  z-index: 99;
}

.middle {
  position: absolute;
  width: 100%;
  left: 0;
  text-align: center;
  margin: 0 auto;
}

.navigation {
  z-index: 1000;
  display: block;
  height: 55px !important;
  width: 100%;
}

body {
  height: 100%;
  background-color: #1d1d1d;
  margin: 0;
  -webkit-font-smoothing: subpixel-antialiased;
}

.bg-dark {
  background-color: #232323 !important;
  color: white;
}

.nav-tabs>a {
  display: inline-block;
  font-size: 18px;
  color: white;
  padding: 0 1.5%;
  transition: background-color 0.2s;
  transition: color 0.2s;
}

.nav-tabs>a:hover {
  color: #ffb300 !important;
  background-color: #313131;
  cursor: pointer;
}

.nav {
  height: 55px !important;
  line-height: 55px;
  max-height: 55px;
  padding: 0px 40px;
  color: white;
}

.no-margin {
  margin: 0;
}

.nav-container {
  width: 100%;
  height: 100%;
  padding: 0 5%;
}

.content {
  height: calc(100% - 55px);
  max-height: calc(100% - 55px);
}

.main>img {
  z-index: -1000;
  position: fixed;
  opacity: 0.75;
}

.shop {
  -webkit-box-pack: start;
  -webkit-justify-content: flex-start;
  -ms-flex-pack: start;
  justify-content: flex-start;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
}

.shop-container {
  -webkit-box-align: start;
  -webkit-align-items: flex-start;
  -ms-flex-align: start;
  align-items: flex-start;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  width: 100%;
  max-width: 1600px;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
}

.items-wrapper {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  margin-right: -4px;
  margin-left: -4px;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -webkit-flex-direction: row;
  -ms-flex-direction: row;
  flex-direction: row;
  -webkit-box-pack: start;
  -webkit-justify-content: flex-start;
  -ms-flex-pack: start;
  justify-content: flex-start;
  -webkit-flex-wrap: wrap;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  -webkit-box-align: stretch;
  -webkit-align-items: stretch;
  -ms-flex-align: stretch;
  align-items: stretch;
  -webkit-align-content: stretch;
  -ms-flex-line-pack: stretch;
  align-content: stretch;
}

.item-wrapper {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  max-width: 25%;
  min-width: 182px;
  padding: 4px;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -webkit-flex-direction: row;
  -ms-flex-direction: row;
  flex-direction: row;
  -webkit-box-pack: start;
  -webkit-justify-content: flex-start;
  -ms-flex-pack: start;
  justify-content: flex-start;
  -webkit-flex-wrap: nowrap;
  -ms-flex-wrap: nowrap;
  flex-wrap: nowrap;
  -webkit-box-align: stretch;
  -webkit-align-items: stretch;
  -ms-flex-align: stretch;
  align-items: stretch;
  -webkit-align-content: flex-end;
  -ms-flex-line-pack: end;
  align-content: flex-end;
  -webkit-box-flex: 13px;
  -webkit-flex: 13px;
  -ms-flex: 13px;
  flex: 13px;
  max-height: 261px;
}

.card {
  transition: background-color 0.5s;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  width: 100%;
  height: 100%;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 auto;
  -ms-flex: 0 0 auto;
  flex: 0 0 auto;
  border-style: none;
  border-width: 1px;
  border-color: rgba(0, 0, 0, .06);
  border-radius: 3px;
  background-color: #2a2a2a !important;
  color: #f3f3f3;
  text-align: center;
  text-decoration: none;
}

.item-image-wrapper {
  position: relative;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  width: 100%;
  padding: 30px 26px 18px 25px;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 auto;
  -ms-flex: 0 0 auto;
  flex: 0 0 auto;
  background-color: hsla(0, 0%, 100%, 0);
}

.item-image {
  display: block;
  height: auto;
  max-width: 120px;
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 auto;
  -ms-flex: 0 0 auto;
  flex: 0 0 auto;
}

img {
  max-width: 100%;
  vertical-align: middle;
  display: inline-block;
}

.price-tag-wrapper.with-line {
  position: static;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -webkit-flex-direction: row;
  -ms-flex-direction: row;
  flex-direction: row;
  background-image: none;
  background-position: 0px 0px;
  background-size: auto;
  background-repeat: repeat;
}

.price-tag-wrapper {
  position: relative;
  display: block;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 auto;
  -ms-flex: 0 0 auto;
  flex: 0 0 auto;
}

.item-info-wrapper {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  width: 100%;
  max-height: 90px;
  min-height: 90px;
  padding: 2px 10px 6px;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-flex-wrap: nowrap;
  -ms-flex-wrap: nowrap;
  flex-wrap: nowrap;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-align-content: center;
  -ms-flex-line-pack: center;
  align-content: center;
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  -ms-flex: 1;
  flex: 1;
}

.price-tag.with-line {
  box-shadow: none;
  letter-spacing: 0px;
}

.price-tag {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  padding: 3px 10px 2px;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  border-radius: 2px;
  background-color: #fff;
  box-shadow: none;
  font-family: Lato, sans-serif;
  color: #000;
  font-size: 14px;
  font-weight: 900;
  text-align: center;
  text-transform: none;
}

.item-name {
  max-width: 100%;
  font-family: Lato, sans-serif;
  color: #fff;
  font-size: 19px;
  line-height: 24px;
  font-weight: 700;
  text-transform: none;
}

.condition {
  margin-top: 2px;
  margin-bottom: 2px;
  color: #fff;
  font-size: 16px;
  font-weight: 300;
}

h4 {
  margin-top: 0px;
  margin-bottom: 0px;
  font-family: Montserrat, sans-serif;
  color: #fff;
  font-weight: 500;
  letter-spacing: 0.5px;
}

@media (max-width: 991px) {
  .item-wrapper {
    min-width: 152px;
    padding: 4px;
    -webkit-flex-basis: 25%;
    -ms-flex-preferred-size: 25%;
    flex-basis: 25%;
  }
}

@media (max-width: 767px) {
  .item-wrapper {
    max-width: 50%;
    min-width: 180px;
    -webkit-flex-basis: 33.3%;
    -ms-flex-preferred-size: 33.3%;
    flex-basis: 33.3%;
  }
}

@media (max-width: 479px) {
  .item-wrapper {
    max-width: 100%;
    -webkit-box-pack: start;
    -webkit-justify-content: flex-start;
    -ms-flex-pack: start;
    justify-content: flex-start;
    -webkit-box-flex: 1;
    -webkit-flex-grow: 1;
    -ms-flex-positive: 1;
    flex-grow: 1;
    -webkit-flex-basis: 50%;
    -ms-flex-preferred-size: 50%;
    flex-basis: 50%;
  }
}

.card:hover {
  background-color: #313131 !important;
  -webkit-transform: none;
  -ms-transform: none;
  transform: none;
  transition: border 0.5s;
}

.responsive-img {
  display: inline-block;
  vertical-align: middle;
  border-radius: 70px;
  border: 2px solid #3b3b3b;
  line-height: 55px;
  transition: border-color 0.2s;
}

.logout {
  display: inline-block;
  margin-left: 10px;
  cursor: pointer;
  color: white;
}

.responsive-img:hover {
  border-width: 2px;
  border-style: solid;
  border-color: #ffb300;
  cursor: pointer;
}

.nav-link {
  max-width: 1600px;
  padding: 18.5px;
  color: white;
  transition: background-color 0.1s;
  transition: color 0.2s;
}

.nav-link:hover {
  color: #ffb300 !important;
  background-color: #313131;
  cursor: pointer;
}

.footer {
  border background-color: #2a2a2a !important;
}
<!DOCTYPE html>
<html>

<head>
  <title>Sale</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
  <link href="https://fonts.googleapis.com/css?family=Lato:400,900" rel="stylesheet">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/css/materialize.min.css">
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
</head>

<body>
  <div class="main">
    <div class="header">
      <div class="navigation bg-dark">
        <div class="nav-container">
          <div class="navbar logo left">
            <h4 class="navbar no-margin">Logo</h4>
          </div>
          <div class="navbar nav-tabs middle">
            <a class="navbar no-margin">SHOP</a>
            <a class="navbar no-margin">TUTORIAL</a>
            <a class="navbar no-margin">SELL</a>
            <a class="navbar no-margin">ABOUT US</a>
          </div>
          <div class="navbar logo right">
            <img class='responsive-img' src='https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/35/35c35c9020dffeaab3711e05afd2bdd9455d3f39.jpg' /><a href='../logout.php' class='no-margin logout'>Logout</a> </div>
        </div>
      </div>
    </div>
    <div class="content">
      <div class="shop">
        <div class="shop-container">
          <div id="items-wrapper" class="items-wrapper">
          </div>
        </div>
      </div>
    </div>
  </div>
</body>

</html>

关于html - 宽度为 100% 的 Div 阻止我点击另一个 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47517802/

相关文章:

HTML - 将图标添加到浏览器选项卡

html - 如何在 Angular Material 13 中添加标题和主体表之间的空间?

html - 父 Div 小于包含在其中的子元素

javascript - 如何在移动设备上通过触摸左右滑动?

python - 使用 Cactus App for Mac 设置全局变量

javascript - 如何在 vue js html 的文本框中显示选定的计划值?

html - 如何使整个 div 在删除内容时消失?

jquery 将文本标签转为 html 标签

javascript - 当我使用 Javascript 添加新的 CSS 样式时,那里的 JS 停止工作

css - Sublime Text 3 - CSS 属性的配色方案