title: Why element with position absolute and z-index not working?
body: <p>I don't understand, why element &quot;preloader-two&quot; appears above &quot;preloader-one&quot;, when &quot;preloader-one&quot; has a higher index than &quot;preloader-two&quot;
  What may be the problem?</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>.preloader-one,
  .preloader-two {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100vh;
  }
  
  .preloader-one {
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 1000;
  }
  
  .preloader-two {
      background-color: #000;
      z-index: 999;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;body&gt;
     &lt;div class="preloader-one"&gt;
          &lt;img&gt;
     &lt;/div&gt;
     &lt;div class="preloader-two"&gt;&lt;/div&gt;
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>