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

170
Vistas
how to increase the size of a div with a list based on the number of elements in the list

index.html

<div class="list">
    <ul>
      <li>item1</li>
      <li>item2</li>
      <li>item3</li>
    </ul>
  </div>

style.css

.list {
    display: flex;
    flex-direction: column;
    max-height: 200px !important;
    overflow: auto;
    min-height : 115px;
}

in the above code the number of li items inside ul tag may vary so I want to keep the height for the div only that will be needed for the li tags to be displayed completely how to change the height dynamically based on the number of li elements and the space they occupy

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try adding max-height to the css of the class you are using.

    .list {
    display: flex;
    flex-direction: column;
    max-height: 200px !important;
    overflow: auto;
    min-height : 115px;
    max-height: 100%;
    }
about 4 years ago · Juan Pablo Isaza 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