Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

141
Visualizações
Why isnt my anchor tags not showing style on hover?

These are the styles I am trying to apply on the li elements when I hover over the list items. But these styles don't appear as of now. What am I doing wrong?

#menu-ul a:hover {
  border-bottom: 2px solid black;
}

#menu-ul a:focus {
  border-bottom: 2px solid black;
}
<ul id="menu-ul">
          <span class="menu-item-selection">
            <a href="#" id="brunch"><li>Brunch</li></a>
          </span>
          <span class="menu-item-selection">
            <a href="#" id="bowls"><li>Bowls</li></a>
          </span>
          <span class="menu-item-selection">
            <a href="#" id="beverages"> <li>Beverages</li></a>
          </span>
          <span class="menu-item-selection">
            <a href="#" id="salads"> <li>Salads</li></a>
          </span>
          <span class="menu-item-selection">
            <a href="#" id="desserts"> <li>Desserts</li></a>
          </span>
        </ul>

about 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

Fist of all fix your structure: <span> can't be a child of <ul> element. This should look like this:

<ul id="menu-ul">
  <li class="menu-item-selection"> 
    <a href="#" id="brunch">Brunch</a>
  </li>
  <li class="menu-item-selection"> 
    <a href="#" id="bowls">Bowls</a>
  </li>
  ...
</ul>
about 4 years ago · Santiago Trujillo Relatório

0

You should target the li element, and not the a element:

#menu-ul a:hover li{
    border-bottom: 2px solid black;
}

#menu-ul a:focus li{
    border-bottom: 2px solid black;
}
about 4 years ago · Santiago Trujillo Relatório

0

You can fix it with just targetting to li after a:hover but I would change html structure

#menu-ul a:hover {
  border-bottom: 2px solid black;
}

#menu-ul a:focus {
  border-bottom: 2px solid black;
}
 <ul id="menu-ul">
          <li>
            <span class="menu-item-selection">
              <a href="#" id="brunch">Brunch</a>
            </span>
          </li>
          <li>
          <span class="menu-item-selection">
            <a href="#" id="bowls">Bowls</a>
          </span>
          </li>
          <li>
          <span class="menu-item-selection">
            <a href="#" id="beverages">Beverages</a>
          </span>
          </li>
</ul>

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda