CSS: animation-fill-mode

The animation-fill-mode property decides whether keyframe styles apply before an animation starts, after it ends, or both.

What you will learn

Keep the final frame

.notice {
  animation: appear 300ms ease-out forwards;
}

@keyframes appear {
  from { opacity: 0; transform: translateY(.5rem); }
  to { opacity: 1; transform: translateY(0); }
}

forwards keeps the styles from the last keyframe after the animation. both also applies the first keyframe during a delay.

Common mistakes