title: Fill only half of the container with a background color
body: <p>I have something like this:</p>
  
  <p><a href="https://i.stack.imgur.com/PYfxp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PYfxp.png" alt="enter image description here"></a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#container {
    width: 300px;
    background-color: red;
    display: flex;
    justify-content: center;
  }
  
  #child {
    background-color: green;
    width: 250px;
    height: 150px;
    position: relative;
    top: 75px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="container"&gt;
    &lt;div id="child"&gt;&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The red box is the container and it's height is equal to its content - in this case 150px. What I'd like to achieve is to make the container height equal half the size of its content size.</p>
  
  <p><strong>The effect that I want to achieve is to have the <code>background-color</code> fill half of the containers content.</strong></p>
  
  <p>If this can be made in some other way than changing the container height - feel free to propose a solution.</p>