锚标记<a> cannot be clicked in a pure css dropdown menu

时间:2015-07-18 19:05:50

标签: html css

When I click on the links in the dropdown menu, it doesn't go any where. It just hided the drop down menu.

What am I doing wrong?

demo

.profile {
  float: right;
  margin-top: 50px;
  margin-right: 20px;
}
.nav- {
  /*margin: 0;
        padding: 0;*/
  list-style-type: none;
}
.nav- li a {
  color: #f00;
}
profile .dropdown > a {
  line-height: 80px;
}
.dropdown a:focus {
  color: #00f;
}
.dropdown-container {
  position: absolute;
  top: 130px;
  right: 0px;
  max-height: 0;
  overflow: hidden;
  background: #FFFFFF;
  color: #fff;
  box-shadow: 0px 0px 2px #FFFFFF;
}
.dropdown a:focus ~ .dropdown-container {
  max-height: 500px;
  transition: max-height 0.5s ease-in;
  -webkit-transition: max-height 0.5s ease-in;
  -moz-transition: max-height 0.5s ease-in;
}
.dropdown-menu li a {
  display: inline-block;
  min-width: 200px;
  padding: 15px 20px;
  border-bottom: 1px solid #333333;
  color: #CCCCCC;
  background-color: #171717;
}
.dropdown-menu li a:hover {
  color: #FFFFFF;
  background: #030303;
}
<body>
  <div class="profile">
    <ul class="nav-">
      <li class="dropdown"><a href="#">Dropdown Menu <i class="fa fa-angle-down"></i></a>

        <div class="dropdown-container">
          <ul class="dropdown-menu">
            <li><a href="google.com">Help <i class="fa fa-question-circle pull-right"></i></a>

            </li>
            <li><a href="google.com">Log out <i class="fa fa-sign-out pull-right"></i></a>

            </li>
          </ul>
        </div>
      </li>
    </ul>
  </div>
</body>

0 个答案:

没有答案