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

105
Vistas
Resize the height of an element from the height of another dynamic element

I have 2 column of text dynamically rendered in nextJS. I want to set the max-height of the second column depending on the height of the first one.

I tried doing this, but it doesn't work. The problem seems to come form passing the variable as value, because if I replace descriptionHeight by 100px for exemple it works.

const descriptionHeight = document.getElementById('desc').offsetHeight;
    const generic = document.getElementById('generic');
    if (descriptionHeight <= generic.offsetHeight) {
      generic.style.maxHeight = descriptionHeight;
    }

I first tried to pass the offsetHeight value with inline style, inside the jsx, but I get an error for variable not defined

about 4 years ago · Juan Pablo Isaza
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