La diferencia entre flex: 1 y flex-grow: 1
Enmdn
flex:1
significa lo mismo que
flex-grow:1
.Sin embargo, de hecho tiene un espectáculo diferente en el navegador.
Puedes probarlo en estejsFiddle cambiando el comentario en css.
Cuando usoflex: 1
el elemento cuyo nombre de clase estest-container
estaránheight:100%
pero no sucederá cuando usesflex-grow: 1
.
No entiendo por qué. Buscando ayuda Muchas gracias.
.flex-1 {
display: flex;
flex-direction: column;
height: 500px;
background: red;
}
.child-1 {
height: 50px;
background: blue;
}
.child-2 {
flex-grow: 1;
/* flex:1; */
background: green;
}
.test-container {
display: flex;
flex-direction: row;
background: white;
height: 100%;
}
<div class="flex-1">
<div class="child-1"></div>
<div class="child-2">
<div class="test-container"></div>
</div>
</div>