Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

140
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda