title: Z-index below text but above background
body: <p>I'm trying to get a div to show as a partial background below the inline content of is containing div but above the background of its container. If I set the z-index of just the partial background to -1 it appears behind the background. But if i set the containing divs z-index to 1 while the contained div's z-index is -1 it displays as desired. </p>
  
  <p>Can someone explain to me why this is and if this is a reliable method or not?</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 {
    position: relative;
    width: 80%;
    height: 18px;
    padding: 6px 10px;
    background: #666;
    z-index: 1;
  }
  
  .partialbg {
    position: absolute;
    left: 0px;
    top: 0px;
    height: 30px;
    width: 80%;
    background: #0CC;
    z-index: -1;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="container"&gt;Text here
    &lt;div class="partialbg"&gt;&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>