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

218
Vistas
Html Paragraph element is not responsive with dynamic text inside

i am building this machinery page for someone and i came across this issue, i am using the latest version of tailwind css and react btw.

For now i am using a plain object to store the items, like this:

const machinery = [{
    image: Machine1,
    name: "Name",
    description: "alkjfaskldjfhaklsd",
    idx: 0
}]

I map this data like this:

<div className="flex flex-col">
    {machinery.map((machine) => {
      return (
        <div key={machine.idx}>
          <p className="text-2xl tex-slate-900 font-Spartan font-semibold">
            {machine.name}
          </p>
          <p className="text-base text-slate-600 font-Spartan font-medium">
            {machine.description}
          </p>
        </div>
      );
    })}
  </div>

Now the issue is that the description text (the secon <p></p> tag) is overflowing the screen (it stays in one line) when it gets smaller, the thing is, if i don't render the text inside like this <p>{machinery.description}</p> but instead i render it normally like this <p>kljaklsjdfhka</p> the text actually splits and does not overflow the screen.

Here is an example:

Dynamically rendered text

-------------|
asdjfhsakdfjh|adkjadfjkhsgd <- the text (it overflows)
             |
             | <- screen border
-------------|

Normally rendered text

-------------|
asdjfhsakdfjh|
adkjadfjkhsgd|<- the text (it does not overflow)
             |
             |<- screen border
-------------|
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use the CSS word-wrap: break-word; on the parrent div of the text, in this example you could add a class or id to your <div key={machine.idx}> like this:

    <style>
    .putYourClassNameHere {
          word-wrap: break-word;
    }
    </style>
        <div className="flex flex-col">
        {machinery.map((machine) => {
          return (
            <div id="putYourClassNameHere" key={machine.idx}>
              <p className="text-2xl tex-slate-900 font-Spartan font-semibold">
                {machine.name}
              </p>
              <p className="text-base text-slate-600 font-Spartan font-medium">
                {machine.description}
              </p>
            </div>
          );
        })}
      </div>
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