Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

166
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda