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

165
Views
How to prevent one child element from scaling

How to prevent scaling #chart while scaling .container?

I want to scale all content (.container) except one div (#chart) while the user resizes the browser window. To this div, I have imported a chart from apexcharts.js and it isn't working properly because of scaling this element. So I want to omit to scale this particular div to fit in all the free space (it is a responsive chart). I have no idea how to do this...

window.addEventListener('resize', () => resizeWindow());

const resizeWindow = () => {
   const {innerWidth: width, innerHeight: height} = window;
  
   if(width < 768) {
      const scale = height/PANEL_HEIGHT;
      document.documentElement.style.setProperty(SCALE_PROPERTY, scale);

      return;
   }
   else {
   const scale = Math.min(width/PANEL_WIDTH, height/PANEL_HEIGHT);
   document.documentElement.style.setProperty(SCALE_PROPERTY, scale);
   }
}
:root {
   --scale-value: 1;
}
.panel {
   height: 1000px;
   width: 1600px;
   position: absolute;
   transform: scale(calc(var(--scale-value) * 0.9));
   transform-origin: center;
}
<div class="container">
  <div id="chart"></div>
</div>

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!