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

264
Views
display:flex, justify-content:space-around is not working properly in React

I'm having trouble figuring out what is wrong with my header, however haven't found any idea yet.

Please check my code first.

// I simplified the code, so no need to worry about variables or etc.

const Header = () => {
  return (
    <header className={styles.headerContainer}>
      <nav className={styles.navContainer}>
        <h1>Frontend Quiz !</h1>
        <p>{currentStage} / 10</p>
          <Link to='/'>
            <button type='button'>Quit</button>
          </Link>
      </nav>
    </header>
  )
}

export default Header
@use '/src/styles/constants/colors';

.headerContainer {
  position: fixed;
  width: 100%;
  height: 60px;
  padding-top: 20px;
  color: colors.$TOPNAV;
  background: colors.$WHITE;

  .navContainer {
    display: flex;
    justify-content: space-around;
    color: colors.$TOPNAV;

    button {
      font-size: 16px;
      color: colors.$TOPNAV;
    }
  }
}

enter image description here

As you can see, even I used display: flex and justify-content: space-around, it is not working properly.

As I know, 1 / 10 should be at center of other two tags, However doesn't work.

If I'm wrong or missing something, please let me know.

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

0

hope i can help.

The element you're trying to space around the way your code is, is the Paragraph and all the buttons inside.

Validate if your structure shouldn't be similar to this:

<div className="spaceAroundClass">
 <h1>Frontend Quiz !</h1>
 <div>Element on Middle</div>
 <div>Buttons Container</div>
</div>
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!