title: CSS Absolute Positioning & Z-Index
body: <p>Say I have the following HTML:</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>.wrapper {
    position: relative;
    z-index: 99;
  }
  
  .red, .green {
    position: absolute;
    top: 0;
    left: 0;
    width: 100px;
    height: 100px;
  }
  
  .red {
    background: red;
    z-index: 400;
  }
  
  .green {
    background: green;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="wrapper"&gt;
    &lt;div class="red"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;br&gt;
  &lt;div class="wrapper"&gt;
    &lt;div class="green"&gt;&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I would like the red box to appear on top of the green box. But it doesn't. The <code>.wrapper</code> has <code>z-index</code> of only <code>99</code> whereas <code>.red</code> has <code>z-index: 100</code>. Are there any hacks top produce <code>.red</code> on top?</p>
  
  <p>Thanks in advance!</p>