title: How to avoid overlapping between two divs positioning absolute inside a div positioning relative?
body: <p>The following code works if the page has enough space to host all divs, but if I resize at minimum the page the two divs positioning absolute overlap. How can I avoid that?</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>#div-chatroom {
    position: relative;
    height: calc(100% - 70px);
    /* IE9+ and future browsers */
    height: -moz-calc(100% - 70px);
    /* Firefox */
    height: -webkit-calc(100% - 70px);
    /* Chrome, Safari */
    padding: 0;
    text-align: center;
    margin: 0;
    border-right: 2px solid #333333;
    overflow: auto;
  }
  
  #div-messages {
    position: absolute;
    top: 10px;
    bottom: 110px;
    left: 10px;
    right: 10px;
    min-height: 200px;
    overflow: auto;
  }
  
  #div-sending {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    height: 100px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="div-chatroom"&gt;
    &lt;div id="div-messages"&gt;messages here&lt;/div&gt;
    &lt;div id="div-sending"&gt;sending tools here&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>UPDATE #1</strong><br>
  As required the code on <a href="http://jsfiddle.net/f_ficarola/3rDx8/18/" rel="nofollow noreferrer">JSFiddle</a> (but if the two divs have <code>position: absolute</code> it doesn't seem to work).</p>