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

174
Vistas
How to get the child width to not exceed the parent's width when parents width did not exceed its max-width value?

The parent div's width did not exceed the value set in its max-width property. How to get child to inherit the actual width of the parent and not cause the parent to increase its width?

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

0

I'm sorry but I didn't really understand the question, but I think what you are searching for is this:

.parent-el {
   max-width: 100px;
   width: 50px;
   border: 3px solid black;
}

.child-el {
  height: 100px;
  width: 100%;
  background-color: red;
}
<html>
  <div class="parent-el">
    <div class="child-el"></div>
  </div>
</html>

I set the child's width to 100%. If you set the child's width to 100%, the child's width becomes 100% of the parent's width. For example if the parent's width is 50px and you set the child's width to

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