title: With a z-index of -1, the after pseudo element is hidden behind background
body: <p>I made a simple progress bar for an online form. It worked fine, until I added a background color on the containing <code>div</code>. It seems that when <code>z-index</code> is set to -1, it hides behind the background of the parent's parent's parent.</p>
  
  <p>The following JS Fiddle shows the error above what is expected.
  <a href="https://jsfiddle.net/h2e52oux/" rel="nofollow noreferrer">https://jsfiddle.net/h2e52oux/</a></p>
  
  <p>What can I do to make the top one work the same as the bottom when there is a background color?</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 {
    height: 100px;
  }
  div.bg {
    background-color: white;
  }
  ul {
    counter-reset: step;
  }
  li {
    list-style-type: none;
    width: 25%;
    text-align: center;
    font-style: italic;
    color: #999;
    float: left;
    position: relative;
  }
  li::before {
    content: counter(step);
    counter-increment: step;
    width: 1.5em;
    text-align: center;
    display: block;
    background: white;
    border: 1px solid #999;
    color: #999;
    margin: 0 auto 5px auto;
  }
  li:not(:first-child)::after {
    content: '';
    width: 100%;
    height: 3px;
    background: white;
    border: 1px solid #999;
    position: absolute;
    top: 0.5em;
    left: -50%;
    z-index: -1;
  }
  li.active {
    color: #222;
    font-style: normal;
  }
  li.active::before,
  li.active::after {
    background: #b05d68;
    color: white;
    border: 0;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="bg"&gt;
    &lt;ul&gt;
      &lt;li class="active"&gt;One&lt;/li&gt;
      &lt;li class="active"&gt;Two&lt;/li&gt;
      &lt;li&gt;Three&lt;/li&gt;
      &lt;li&gt;Four&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;ul&gt;
      &lt;li class="active"&gt;One&lt;/li&gt;
      &lt;li class="active"&gt;Two&lt;/li&gt;
      &lt;li&gt;Three&lt;/li&gt;
      &lt;li&gt;Four&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>