Tilting Bouncing Button

A CSS-only hover effect where the button scales down and tilts, the text wrapper counter-rotates to stay level, and the text slides up to reveal a text-shadow duplicate beneath it. Uses a custom CSS linear() easing curve to produce an elastic bounce without any JavaScript.

csshoverbuttonanimationelasticlinear-easing

Code

index.html
html
<div class="btn-group">
  <div class="btn-group__col">
    <a href="#" class="btn-bounce">
      <div class="btn-bounce-bg"></div>
      <div class="btn-bounce-text__wrap">
        <span class="btn-bounce-text">Bouncy Button</span>
      </div>
    </a>
  </div>
  <div class="btn-group__col">
    <a href="#" class="btn-bounce is--secondary">
      <div class="btn-bounce-bg is--secondary"></div>
      <div class="btn-bounce-text__wrap">
        <span class="btn-bounce-text">Bouncy Button</span>
      </div>
    </a>
  </div>
</div>
styles.css
css
:root {
  --ease-elastic: linear(0, 0.55 7.5%, 0.85 12%, 0.95 14%, 1.03 16.5%, 1.09 20%, 1.13 22%, 1.14 23%, 1.15 24.5%, 1.15 26%, 1.13 28%, 1.11 31%, 1.05 39%, 1.02 43%, 0.99 47%, 0.98 52%, 0.97 59%, 1.002 81%, 1);
}

.btn-group {
  grid-column-gap: 3em;
  grid-row-gap: 3em;
  justify-content: center;
  align-items: flex-start;
  display: flex;
}

.btn-bounce {
  color: #113d28;
  padding-left: 2em;
  padding-right: 2em;
  font-size: 1em;
  text-decoration: none;
  position: relative;
}

.btn-bounce.is--secondary {
  color: #fff;
}

.btn-bounce-bg {
  z-index: 0;
  background-color: #55db9c;
  border-radius: 100em;
  position: absolute;
  inset: 0%;
}

.btn-bounce-bg.is--secondary {
  background-color: #55db9c26;
  border: 1px solid #55db9c40;
}

.btn-bounce-text {
  z-index: 1;
  display: block;
  position: relative;
}

.btn-bounce-text__wrap {
  padding-top: 1.25em;
  padding-bottom: 1.25em;
  overflow: hidden;
}

/* Only apply hover animations on devices that support hover */
@media (hover: hover) and (pointer: fine) {
  .btn-bounce,
  .btn-bounce-text,
  .btn-bounce-text__wrap {
    transition: transform 0.65s var(--ease-elastic);
  }

  /* Fake a duplicate text element using text-shadow without blur */
  /* We save the distance in a variable for easy use in the CSS animation */
  .btn-bounce-text {
    --text-duplicate-distance: 3em;
    text-shadow: 0px var(--text-duplicate-distance) currentColor;
  }

  /* Scale down the button and rotate it slightly */
  .btn-bounce:hover { transform: scale(0.92) rotate(-3deg); }

  /* Rotate the text wrapper in the opposite direction so it appears straight */
  .btn-bounce:hover .btn-bounce-text__wrap { transform: rotate(3deg); }

  /* Move up the text span to reveal its text-shadow */
  .btn-bounce:hover .btn-bounce-text { transform: translate(0px, calc(-1 * var(--text-duplicate-distance))); }
}

Guide

Overview

Three nested elements each transform independently on hover: the button tilts and scales, the text wrapper counter-rotates so the label stays visually level, and the text span slides up to reveal a text-shadow copy sitting below it — all driven purely by CSS transitions.

Text Duplicate

The second line of text is a text-shadow with no blur (0px blur, currentColor). The .btn-bounce-text__wrap clips the overflow so the shadow is hidden at rest. On hover the span shifts up by --text-duplicate-distance, pulling the shadow into view.

Elastic Easing

The custom linear() easing curve simulates a bounce by overshooting past 1 before settling. The many coordinate pairs approximate a smooth curve — straight lines connect each point so more points mean a smoother arc. Adjust the values to tune the bounciness.

Hover Guard

All hover styles are wrapped in @media (hover: hover) and (pointer: fine) so the effect only applies on devices with a real pointer. Touch devices see the button without any transition side-effects.