<!doctype html>
<meta charset="utf-8">
<style>
  .container {
    width: 100px;
  }

  .half {
    height: 50%;
    background-color: green;
  }
</style>
<div class="container" style="height: 100px">
  <div class="half"></div>
</div>
<div class="container" style="height: 200px">
  <div class="half"></div>
</div>
