title: How to make flexbox child's height to fit to content instead of 100% height of its container
body: <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#container {
    display:flex;
    height:300px;
    background:#333;
  }
  #child1 {
    width:30%;
    background:#3cf;
  }
  #child2 {
    width:30%;
    background:#3fc;
  }
  #child3 {
    width:40%;
    background:#cf3;
  }
  #child1_child {
    width:100%;
    background:#fc3;
  }
  pre {
    margin:0px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    &lt;div id="container"&gt;
      &lt;div id="child1"&gt;&lt;div id="child1_child"&gt;&lt;pre&gt;CONTENT&lt;BR&gt;CONTENT&lt;BR&gt;CONTENT&lt;BR&gt;CONTENT&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
      &lt;div id="child2"&gt;&lt;/div&gt;
      &lt;div id="child3"&gt;&lt;/div&gt;
      &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The height of <code>#child1</code> is automatically set to the same height of <code>#container</code>, How can I make it to fit to <code>#child1_child</code> rather than 100% height of <code>#container</code>?</p>
  
  <p>The height of <code>#child1_child</code> is not static, it can be changed by content inside of it, height of <code>#child1</code> with static value is useless.</p>