I am trying to animate the expansion of a div with flexible height. The animation is going from height: 0px to the target height. However, I do not no the target height. Therefore I have just assumed a height which is near the real height. This gives a very bad looking effect, since I am always overestimating or underestimating the height.
.expandable {
  background-color: red;
  width: 200px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation-name: expand;
  animation-duration: 1s;
  animation-timing-function: ease-out;
}
@keyframes expand {
  from {
    height: 0px
  }
  to {
    height: 100px
  }
}<div class="expandable">
  text
  <br />text
  <br/>text
  <br />text
  <br/>text
  <br />text
  <br/>text
</div>See my fiddle: https://jsfiddle.net/gh3y1sbf/
what I would like to see is that the animation is smooth to the actual target height of the div.
Any ideas how this is possible? preferably without using javascript. Also, I am not using JQuery.
 
     
     
    