Does anchor tag and Hover not work in a drop-menu?

Asked

Viewed 109 times

1

I’m trying to create a drop-menu, but the tag <a> and :hover doesn’t work, when I step or mouse over it is as if I have nothing.

#menu-block {
  width: 100%;
  height: 42px;
  margin-top: 5px;
  background: #111111;
}

.menu {
  padding: 0;
  width: 100%;
  height: 40px;
  display: flex;
  justify-content: space-around;
}

.menu li a {
  display: none;
  color: #fff;
  position: absolute;
  font: bold 100% Arial, Tahoma, Helvetica;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
}

.menu li {
  width: 10%;
  height: 42px;
  position: relative;
}

.menu li a {
  width: 100%;
  height: 100%;
  transition: background 1s ease;
  position: relative;
}

.menu li a:hover {
  transition: 2s ease;
  background: #00b2ff;
}

.menu li a:not(:hover) {
  transition: 3s ease;
}

.menu li ul {
  width: 100%;
  height: auto;
  position: relative;
  display: block;
}

.menu li ul li {
  width: 100%;
  height: 42px;
  position: relative;
  background: #1a1a1a;
  border-style: solid;
  border-width: 1px;
  border-color: #00b2ff;
}

.menu li ul li a {
  width: 100%;
  height: 100%;
}

.menu li ul li:hover {
  background: #00b2ff;
}
<div id="menu-block">
  <ul class="menu">
    <li><a href="#"><span>NOTICIAS</span></a>
      <ul>
        <li>
          <a href="#">
            <p>PAGINA</p>
          </a>
        </li>
        <li>
          <a href="#">
            <p>PAGINA</p>
          </a>
        </li>
        <li>
          <a href="#">
            <p>PAGINA</p>
          </a>
        </li>
        <li>
          <a href="#">
            <p>PAGINA</p>
          </a>
        </li>
        <li>
          <a href="#">
            <p>PAGINA</p>
          </a>
        </li>
        <li>
          <a href="#">
            <p>PAGINA</p>
          </a>
        </li>
        <li>
          <a href="#">
            <p>PAGINA</p>
          </a>
        </li>
        <li>
          <a href="#">
            <p>PAGINA</p>
          </a>
        </li>
        <li>
          <a href="#">
            <p>PAGINA</p>
          </a>
        </li>
        <li>
          <a href="#">
            <p>PAGINA</p>
          </a>
        </li>
      </ul>
    </li>
    <li><a href="#"><span>SOBRE</span></a></li>
    <li><a href="#"><span>CONTATO</span></a></li>
  </ul>
</div>

  • 1

    What would be a:not(:hover)? Which is exactly the part that didn’t work?

  • a:not(:Hover) is to give time in Transition when taking the mouse, what did not work was that the submenu appears, but when I pass the mouse over nothing happens, the link that is in the anchor does not appear and the submenu transition does not happen.

  • What you should see is that there are several display in the .menu li a and there are also two .menu li a in his css.

  • that . menu li a works but the . menu li ul li a no.

  • Remove the None display from the 3° css line, overflow:Hidden na li so that it does not generate a scroll, and when there is the Hover in the first read of this list ". menu > li:Hover" {height: ! heightTotalDaLista}, I advise to give height with javascript, so you don’t risk putting an inaccurate value

  • There are several problems. In both css and HTML, for someone to answer this question with their own code they will need to practically redo it.

  • @Caymmi, managed to solve your problem?

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.