frontendhack-logo
Demo
Open in generator

Roll Out Top is a roll out CSS keyframe animation with 2 keyframe steps (0% → 100%). It animates transform (translateY, rotate) and opacity. The element fades out completely, so use the forwards fill mode to keep it hidden afterwards.

Roll Out animations spin the element as it leaves, like a wheel rolling away. They add personality to exits for icons, badges and playful interfaces.

Animation shorthand

.element {
  animation: roll-out-top 1s ease 0s 1 normal forwards;
}

@keyframes code

@keyframes roll-out-top {
  0% { opacity: 1; transform: translateY(0) rotate(0); }
  100% { opacity: 0; transform: translateY(-400px) rotate(-360deg); }
}

HTML

<div class="element">Animated content</div>

Keyframe steps

StepStyles
0%opacity: 1; transform: translateY(0) rotate(0);
100%opacity: 0; transform: translateY(-400px) rotate(-360deg);

Respect reduced motion

@media (prefers-reduced-motion: reduce) {
  .element {
    animation: none;
  }
}

More Roll Out animations

Frequently Asked Questions

Copy the @keyframes roll-out-top block and the animation shorthand into your stylesheet, then add the class to any element. The shorthand reads name, duration, timing function, delay, iteration count, direction and fill mode.

Yes. Change the second value in the shorthand, for example 2s for a slower animation, or use the settings above the code to try duration, timing, delay, repeat count, direction and fill mode and copy the updated CSS.

The last keyframe sets opacity to 0 and the forwards fill mode keeps that final state. Remove forwards if you want the element to reappear when the animation ends.

Yes. It only animates transform and opacity, which browsers can hand to the GPU, so it stays smooth even on mobile devices.