title: CSS Touch Ripple Effect, Not Working Properly
body: <p>My CSS touch ripple is not working properly. It is just seen like a bubble in the center when i click on the button. Please help in finding where am i doing the mistake. i am not much known to CSS animations. i would like to do this using just CSS only.</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>.ripple-con,
  .button {
    display: inline-block;
    position: relative;
    overflow: hidden;
  }
  
  .button::after,
  .ripple {
    content: ' ';
    background: rgba(0, 0, 0, 0.3);
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    display: inline-block;
    border-radius: 100%;
  }
  
  .button:active::after,
  .ripple:active,
  .button:active+.ripple {
    animation: ripple 2s;
  }
  
  @keyframes ripple {
    to {
      opacity: 0;
      margin: -250px;
      width: 500px;
      height: 500px;
    }
  }
  
  .button {
    line-height: 39px;
    border: 0;
    height: 42px;
    box-sizing: border-box;
    padding: 0 20px;
    background: #888;
    border-radius: 5px;
    cursor: default;
    vertical-align: top;
  }
  
  html {
    text-align: center
  }
  
  body {
    display: inline-block
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="ripple-con"&gt;
    &lt;input class="button" type="submit" value="Submit Button : Button"&gt;
    &lt;span class="ripple"&gt;&lt;/span&gt;
  &lt;/div&gt;
  
  &lt;div class="ripple-con"&gt;
    &lt;input class="button" type="button" value="Input Button : Button"&gt;
    &lt;span class="ripple"&gt;&lt;/span&gt;
  &lt;/div&gt;
  
  &lt;div class="button"&gt;Div : Button&lt;/div&gt;
  
  &lt;button class="button"&gt;Button : Button&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>