title: Horizontally centering text in CSS animations
body: <p>The CSS seems to be horizontally centering the text by the first letter. I'd like to make it be perfectly centered on the page, without breaking the animation. I added a gradient to show the exact horizontal center of the page. </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 {
    height: 100vh;
    background: linear-gradient(to right, #1e5799 0%,#ffffff 50%,#7db9e8 100%);
  }
  
  .container {
    text-align: center;
  }
  
  .vcenter {
    position: relative;
    top: calc(50%);
    -webkit-transform: translateY(-50%);
    -ms-transform: translateY(-50%);
    transform: translateY(-50%);
  }
  
  .container h2 {
    background: red;
    display: inline-block;
    position: absolute;
    opacity: 0;
    overflow: visible;
    -webkit-animation: rotateWord 12s linear infinite 0s;
    -ms-animation: rotateWord 12s linear infinite 0s;
    animation: rotateWord 12s linear infinite 0s;
    margin: 0;
  }
  
  .container h2:nth-child(2) {
    -webkit-animation: rotateWord 12s linear infinite 3s;
    -ms-animation: rotateWord 12s linear infinite 3s;
    animation: rotateWord 12s linear infinite 3s;
  }
  
  .container h2:nth-child(3) {
    -webkit-animation: rotateWord 12s linear infinite 6s;
    -ms-animation: rotateWord 12s linear infinite 6s;
    animation: rotateWord 12s linear infinite 6s;
  }
  
  .container h2:nth-child(4) {
    -webkit-animation: rotateWord 12s linear infinite 9s;
    -ms-animation: rotateWord 12s linear infinite 9s;
    animation: rotateWord 12s linear infinite 9s;
  }
  
  @-webkit-keyframes rotateWord {
    0% {
      opacity: 0;
    }
    2% {
      opacity: 0;
      -webkit-transform: translateY(-30px);
    }
    5% {
      opacity: 1;
      -webkit-transform: translateY(0px);
    }
    17% {
      opacity: 1;
      -webkit-transform: translateY(0px);
    }
    20% {
      opacity: 0;
      -webkit-transform: translateY(30px);
    }
    80% {
      opacity: 0;
    }
    100% {
      opacity: 0;
    }
  }
  
  @-moz-keyframes rotateWord {
    0% {
      opacity: 0;
    }
    2% {
      opacity: 0;
      -ms-transform: translateY(-30px);
    }
    5% {
      opacity: 1;
      -ms-transform: translateY(0px);
    }
    17% {
      opacity: 1;
      -ms-transform: translateY(0px);
    }
    20% {
      opacity: 0;
      -ms-transform: translateY(30px);
    }
    80% {
      opacity: 0;
    }
    100% {
      opacity: 0;
    }
  }
  
  @keyframes rotateWord {
    0% {
      opacity: 0;
    }
    2% {
      opacity: 0;
      -webkit-transform: translateY(-30px);
      transform: translateY(-30px);
    }
    5% {
      opacity: 1;
      -webkit-transform: translateY(0px);
      transform: translateY(0px);
    }
    17% {
      opacity: 1;
      -webkit-transform: translateY(0px);
      transform: translateY(0px);
    }
    20% {
      opacity: 0;
      -webkit-transform: translateY(30px);
      transform: translateY(30px);
    }
    80% {
      opacity: 0;
    }
    100% {
      opacity: 0;
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="wrapper"&gt;
    &lt;div class="container vcenter"&gt;
      &lt;h2&gt;HEY THERE THIS IS TEXT&lt;/h2&gt;
      &lt;h2&gt;DIFFERENT TEXT&lt;/h2&gt;
      &lt;h2&gt;THIS IS TEXT&lt;/h2&gt;
      &lt;h2&gt;DIFFERENT LENGTHS OF TEXT&lt;/h2&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>