Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

267
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda