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

147
Vistas
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 Respuestas
Responde la pregunta

0

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

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