title: Overlap two centered elements using CSS flexbox
body: <p>I'm trying to absolutely center two elements in the middle of the page, with one behind the other. The intent is to have a page that is fully responsive with a circle in the middle which has a pulse effect behind it. </p>
  
  <p><a href="http://jsfiddle.net/Fy8vD/2003/" rel="noreferrer">Here is a fiddle</a> of the below:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>html,
  body {
    height: 100%;
    width: 100%;
  }
  body {
    background: lightblue;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .container {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .sphere {
    display: flex;
    background: black;
    border-radius: 300px;
    height: 100px;
    width: 100px;
  }
  .container:after {
    display: flex;
    background: #FFF;
    border-radius: 300px;
    height: 130px;
    width: 130px;
    animation: pulsate 2.5s ease-out;
    animation-iteration-count: infinite;
    opacity: 0.0;
    content: "";
    z-index: -1;
    margin: auto;
  }
  @keyframes pulsate {
    0% {
      transform: scale(0.1, 0.1);
      opacity: 0.0;
    }
    50% {
      opacity: 1.0;
    }
    100% {
      transform: scale(1.2, 1.2);
      opacity: 0.0;
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="container"&gt;
    &lt;div class="sphere"&gt;&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <h3>Method:</h3>
  
  <p>I'm currently using flexbox to center a container div with a circle inside, and an <code>:after</code> tag on the container to create the pulse. I've tried using z-indexing (doesn't seem to do anything), and absolute positioning (which requires hard-coded px values which I'd like to stay away from).</p>
  
  <p>Is there a graceful way to achieve this using flexbox?</p>
  
  <h3>Desired Effect:</h3>
  
  <p><a href="http://jsfiddle.net/Fy8vD/2004/" rel="noreferrer">This is close</a>, but I'd like to move away from using px values for the <code>:after</code> element if possible.</p>