Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!