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

150
Views
How to make all contents of a div shrink to fit the div if needed?

I have a some html elements like this:

        <div>
          <div>
            <div id="container"></div>
          </div>
        </div>

And I dynamically add other elements to the container. How can I make all contents of the container fit inside of the div. Basically I don't want the user to scroll at all. I need all contents to shrink-to-fit if needed.

This is the CSS I have for the container:

#container {
  display: grid;
  grid-gap: 0.02em;
  grid-template-rows: repeat(var(--grid-rows), 1fr);
  grid-template-columns: repeat(var(--grid-cols), 1fr);
}
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The solution is to set the div with the id of container to display: inline-block.

about 4 years ago · Santiago Trujillo Report
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!