CSS3 Keyframe Animations, Filters and Loaders: @keyframes, animation Properties, blur, drop-shadow and Respecting Reduced Motion

HTML5 and CSS3 55 min min read Updated: Nov 17, 2026 Intermediate
CSS3 Keyframe Animations, Filters and Loaders: @keyframes, animation Properties, blur, drop-shadow and Respecting Reduced Motion
Intermediate Topic 3 of 3

Transition vs Animation

TransitionAnimation
Needs a triggerYes, like hoverNo, can run alone
StepsStart and endMany steps with keyframes
RepeatNoYes

Define and Use Keyframes

css @keyframes fade-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } .hero h1 { animation: fade-up .8s ease-out both; }

Shorthand: animation: name duration timing-function delay iteration-count direction fill-mode;

PropertyMeaning
animation-nameWhich @keyframes to run
animation-durationHow long one cycle takes
animation-iteration-countHow many times, or infinite
animation-directionnormal, reverse, alternate
animation-fill-modeboth keeps the first and last frames before and after
animation-play-staterunning or paused

Multi-step Keyframes: A Pulse

css @keyframes pulse { 0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(11, 95, 255, .5); } 70% { transform: scale(1.05); box-shadow: 0 0 0 14px rgba(11, 95, 255, 0); } 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(11, 95, 255, 0); } } .cta { animation: pulse 2s infinite; }

A CSS Loading Spinner

html <div class="spinner" role="status" aria-label="Loading"></div>
css .spinner { width: 40px; height: 40px; border: 4px solid #d6e2ff; border-top-color: #0b5fff; border-radius: 50%; animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }

Filters

css img.gray { filter: grayscale(100%); transition: filter .3s; } img.gray:hover { filter: none; } .glass { backdrop-filter: blur(8px); background: rgba(255, 255, 255, .5); } .shadowed { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .3)); } .dim { filter: brightness(.8) contrast(1.1); }
FilterEffect
blur(px)Soften
grayscale(%)Remove color
brightness(n)Lighter or darker
drop-shadow()Shadow that follows the shape, even for transparent PNGs and SVG

Be Kind to People: Reduced Motion

css @media (prefers-reduced-motion: reduce) { .cta, .hero h1 { animation: none; } .spinner { animation-duration: 3s; } }
Avoid flashing Never flash content more than three times per second. It can be dangerous for some people. Do not make important information appear only inside an animation.

Practice

  1. Fade and slide in a heading on page load
  2. Build a spinner and a pulsing button
  3. Make a photo gray until hover

Conclusion

Keyframes run multi-step animations by themselves. Use animation properties, filters and always respect reduced motion.

Quick Summary: Transition vs animation; keyframes; pulse; spinner; filters; reduced motion.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators