0

I am trying to make top child in container auto expand height to 100% if second child (box) does not exist. Is this the good method?

.container{
  position:absolute;
  display:flex;
  flex-direction:column;
  justify-content:stretch;
  width:200px;
  height:300px;
  border:1px solid blue;
}
.item{
  flex-grow:1; 
  width:100%;
  border:1px solid red;   
}
.bar{
  position:relative;
  height:40px;
  background:red;
  width:100%;

  
}
<div class='container'>
  <div class='item'>One</div>
  <div class='bar'>Two</div>
</div>

o shrink

Toniq
  • 4,492
  • 12
  • 50
  • 109

0 Answers0