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

168
Visualizações
I am trying to get words be displayed in their own row so one word under each other

I have an array of words being passed to a component and trying to display each word underneath each other in input tags but they are being displayed next to each otherenter image description here

my file:

const Words = ({arr}) => {

let num = ((100/arr.length) - (1)).toString() + '%';
console.log(arr)
return (
    <div>

        {arr.map((letter, idx) =>{
            return(
                <input 
                    className="letters" 
                    type='text' 
                    key={idx} 
                    style={{width: num}}
                />
            )
        })}

        <br/>
    </div>
)

}

CSS file:

    .letters{
    display: flex;
    float:left;
    margin-left: 2px;
}

my main file:

    const App = () => {
  let words = ['Hello', 'World']
  return(
    <Container className="main-content">
      {words.map((word) =>{
        return(
          <Words arr={word.split('')} />
        )
      })}
    </Container>
  );
}

CSS file:

    .main-content{

  display: flex;
  background-color: gray;
  color: white;
  min-height: 100vh;
  width: 100%;
  align-items: center;
  justify-content: center;
  left: 10%;
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

  • Remove floats and display: flex from your INPUT elements
  • Use flex-direction: column; on the parent element
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