Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

151
Visualizações
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 Respostas
Responde à pergunta

0

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

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda