Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

108
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!