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

182
Views
how do I style a child div in nextjs using css

I am working on the menu bar of a website.

I am using nextjs for my application

I want to style the a tag

but it did not work

My code

Javascript

const Nav = () => {
    return (
        <div className={styles.nav}>
            <div className={styles.topNav}>
                <div className="d-flex justify-content-between">
                    <div>
                        <Link href="/">
                            <a>
                                Logo
                            </a>
                        </Link>
                    </div>
                    <div className={styles.navLinks}>
                        
                    </div>
                    <div onClick={openMenu} className={styles.menuHamburger}>Menu</div>
                </div>
            </div>
        </div>
    )
}

CSS

.topNav{
    background-color: blue;
    padding: 1.5rem 1rem;
}

.topNav > div > a{
    color: white;
}


    
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You used the child selector > in .topNav > div > a, meaning you're only styling an <a> that is the child of a <div> that is the child of an element with the .topNav class. Your <a> is only a descendant here. You can use a space instead to specify any descendant: .topNav > div a

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!