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

167
Vistas
Adds the effect of the hover on the chilled element using the styled component

Good evening everyone. I'm trying to build a component using React and use the Style Component to add the CSS. But when adding the Hover effect to the element (a), the effect is also reflected on all the elements inside the (a). As in the picture enter image description here

<Section>
<PortLogin>
<h1>Welcome to Your Profettional Community</h1>

 <ul>
   <a href="##" ><li href="##">Search For a job</li><i className="fas fa-chevron-right"></i> 
 </a>
   <a  href="##"><li href="##">Find a Person You Know</li><i className="fas fa-chevron-right"> 
 </i></a>
   <a  href="##"><li href="##">Learn a new skill</li><i className="fas fa-chevron-right"></i> 
 </a>
   
 </ul>
 </PortLogin>
 <img src="Img/SectionImg.svg" alt="Img Section "></img>

  </Section>

my styled-components

const Section=styled.div`

display: flex;
justify-content: start;
 flex-wrap:wrap;
 margin-top: 40px;

 & img{
   width: 500px;
   position: absolute;
   right: 0;
     }
 `;

 const PortLogin=styled.div`
 margin-top: 25px;
 display:flex;
 flex-direction:column;
 justify-content:space-around;

 & ul{
  margin-top:50px;
 
     & :hover {
     box-shadow: 3px 3px 8px 2px #00000040;
      }
      }

    & ul>a{
       text-decoration:none;
       padding: 25px 20px;
       margin-bottom: 20px;
       width:70%;
       list-style: none;  
       display: flex;
       justify-content:space-between;
       border: 1px solid #d3cccc;
       border-radius: 13px;
       font-size: larger
     }

      ul li a{
      text-decoration: none;
      color:Black;
     }
      `
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

I solved the problem. The solution is very simple. I have to use Direct Child

const PortLogin = styled.div`
   margin-top: 25px;
   display: flex;
   flex-direction: column;
   justify-content: space-around;

    & > ul {
    margin-top: 50px;
     }

     & ul > a {
     text-decoration: none;
     padding: 25px 20px;
     margin-bottom: 20px;
     width: 70%;
     list-style: none;
     display: flex;
     justify-content: space-between;
     border: 1px solid #d3cccc;
     border-radius: 13px;
     font-size: larger;
      }

       ul > li > a {
       text-decoration: none;
       color: Black;
        }
       ul > li > a:hover {
       text-decoration: underline;
        }
         `;
          `
about 4 years ago · Juan Pablo Isaza Denunciar

0

You need to move your hover class out of your ul tag (which is wrapping all of the elements within, so all lists and links within it.

I assume you want the links to be hoverable only, so something like this should be more appropriate:

const PortLogin = styled.div`
  margin-top: 25px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;

  & ul {
    margin-top: 50px;
  }

  & ul > a {
    text-decoration: none;
    padding: 25px 20px;
    margin-bottom: 20px;
    width: 70%;
    list-style: none;
    display: flex;
    justify-content: space-between;
    border: 1px solid #d3cccc;
    border-radius: 13px;
    font-size: larger;
  }

  ul li a {
    text-decoration: none;
    color: Black;
  }
  ul li a:hover {
    text-decoration: underline;
  }
`;
`
about 4 years ago · Juan Pablo Isaza 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