Bird
Raised Fist0
Tailwindmarkup~20 mins

Custom keyframe animations in Tailwind - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Master of Custom Keyframe Animations
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2:00remaining
Identify the correct Tailwind CSS custom keyframe syntax
Which option correctly defines a custom keyframe animation named fadeIn in Tailwind CSS configuration?
A"keyframes": { 'fadeIn': { '0%': { opacity: 0 }, '100%': { opacity: 1 } } }
B"keyframes": { "fadeIn": { "0%": { opacity: '0' }, "100%": { opacity: '1' } } }
C"keyframes": { fadeIn: { 'from': { opacity: 0 }, 'to': { opacity: 1 } } }
D"keyframes": { fadeIn: { 0: { opacity: '0' }, 100: { opacity: '1' } } }
Attempts:
2 left
💡 Hint
Remember that keys for percentages must be strings with % sign, and opacity values are numbers without quotes.
❓ rendering
intermediate
2:00remaining
What visual effect does this Tailwind animation produce?
Given this Tailwind CSS animation configuration and usage, what will you see in the browser?

module.exports = {
  theme: {
    extend: {
      keyframes: {
        slideRight: {
          '0%': { transform: 'translateX(0)' },
          '100%': { transform: 'translateX(100px)' }
        }
      },
      animation: {
        slideRight: 'slideRight 2s ease-in-out forwards'
      }
    }
  }
}


AA blue square rotates 360 degrees in 2 seconds.
BA blue square fades out gradually over 2 seconds.
CA blue square moves smoothly 100 pixels to the right over 2 seconds and stays there.
DA blue square moves 100 pixels to the left and then returns to start.
Attempts:
2 left
💡 Hint
Look at the transform property and the animation direction.
❓ selector
advanced
2:00remaining
Which Tailwind utility applies a custom animation named 'bounceSlow'?
If you define a custom animation named bounceSlow in Tailwind config, which class applies it correctly to an element?
AbounceSlow-animate
Banimation-bounceSlow
Canimate__bounceSlow
Danimate-bounceSlow
Attempts:
2 left
💡 Hint
Tailwind animation utilities start with 'animate-' prefix.
❓ layout
advanced
2:00remaining
How to combine custom keyframe animation with Flexbox layout in Tailwind?
You want a container to center its children horizontally and vertically and apply a custom fade-in animation on load. Which Tailwind classes achieve this?
Agrid place-items-center animate-fadeIn
Bflex justify-center items-center animate-fadeIn
Cflex justify-center animate-fadeIn
Dflex items-center animate-fadeIn
Attempts:
2 left
💡 Hint
Flexbox centering requires both justify-center and items-center.
❓ accessibility
expert
2:00remaining
How to ensure custom keyframe animations in Tailwind are accessible?
Which approach best improves accessibility when using custom animations in Tailwind CSS?
ARespect prefers-reduced-motion media query to disable animations for users who prefer less motion.
BUse very fast animations to minimize distraction.
CAdd aria-hidden="true" to animated elements to hide them from screen readers.
DUse only color changes in animations to avoid motion issues.
Attempts:
2 left
💡 Hint
Consider user preferences for motion sensitivity.

Practice

(1/5)
1. What is the main purpose of defining custom keyframe animations in Tailwind CSS?
easy
A. To create unique movement effects on webpage elements
B. To change the color palette of the website
C. To add new font families to the project
D. To optimize image loading speed

Solution

  1. Step 1: Understand what keyframe animations do

    Keyframe animations define how elements move or change over time.
  2. Step 2: Relate to Tailwind's custom animations

    Custom keyframe animations let you create unique movement effects beyond default animations.
  3. Final Answer:

    To create unique movement effects on webpage elements -> Option A
  4. Quick Check:

    Custom animations = unique movements [OK]
Hint: Think about what animations visually do on a page [OK]
Common Mistakes:
  • Confusing animations with color or font changes
  • Thinking animations improve loading speed
  • Mixing animations with layout changes
2. Which of the following is the correct way to define a custom keyframe animation in Tailwind's tailwind.config.js?
easy
A. "extend: { colors: { bounce: '#000' }, animation: { bounce: 'bounce 1s infinite' } }"
B. "extend: { keyframes: { bounce: { '0%': { transform: 'translateY(0)' }, '50%': { transform: 'translateY(-25%)' }, '100%': { transform: 'translateY(0)' } } }, animation: { bounce: 'bounce 1s infinite' } }"
C. "extend: { fontFamily: { bounce: ['Arial'] }, animation: { bounce: 'bounce 1s infinite' } }"
D. "extend: { spacing: { bounce: '1rem' }, animation: { bounce: 'bounce 1s infinite' } }"

Solution

  1. Step 1: Identify keyframe syntax in Tailwind config

    Keyframes are defined inside extend.keyframes with percentage steps and CSS properties.
  2. Step 2: Check animation property linking keyframes

    The animation name and duration are set inside extend.animation.
  3. Final Answer:

    extend: { keyframes: { bounce: { '0%': { transform: 'translateY(0)' }, '50%': { transform: 'translateY(-25%)' }, '100%': { transform: 'translateY(0)' } } }, animation: { bounce: 'bounce 1s infinite' } } -> Option B
  4. Quick Check:

    Keyframes + animation property = correct syntax [OK]
Hint: Look for keyframes with percentages and transform properties [OK]
Common Mistakes:
  • Defining colors or fonts instead of keyframes
  • Missing percentage steps in keyframes
  • Not linking animation name to keyframes
3. Given this Tailwind config snippet:
extend: { keyframes: { fadeIn: { '0%': { opacity: '0' }, '100%': { opacity: '1' } } }, animation: { fadeIn: 'fadeIn 2s ease-in forwards' } }

What will happen when you add class="animate-fadeIn" to an element?
medium
A. The element will instantly appear without animation
B. The element will slide left to right repeatedly
C. The element will fade out from visible to transparent
D. The element will fade in from transparent to fully visible over 2 seconds

Solution

  1. Step 1: Analyze keyframes named fadeIn

    Opacity changes from 0 (invisible) at 0% to 1 (visible) at 100%.
  2. Step 2: Understand animation properties

    Animation lasts 2 seconds, easing in, and stays at final state (forwards).
  3. Final Answer:

    Element fades in from transparent to visible over 2 seconds -> Option D
  4. Quick Check:

    fadeIn keyframes = fade in effect [OK]
Hint: Check opacity changes in keyframes for fade effects [OK]
Common Mistakes:
  • Confusing fadeIn with slide animations
  • Ignoring animation duration and easing
  • Assuming fade out instead of fade in
4. You wrote this Tailwind config for a custom animation:
extend: { keyframes: { spinSlow: { '0%': { transform: 'rotate(0deg)' }, '100%': { transform: 'rotate(360deg)' } } }, animation: { spinSlow: 'spinSlow 3s linear infinite' } }

But the animation does not run on your element with class="animate-spinSlow". What is the likely problem?
medium
A. You forgot to restart the development server after changing the config
B. The keyframe percentages must be 0 and 1, not 0% and 100%
C. The animation name in the class should be spin-slow instead of spinSlow
D. Tailwind does not support custom animations

Solution

  1. Step 1: Check Tailwind config syntax

    The keyframe and animation syntax is correct with '0%' and '100%' and camelCase names.
  2. Step 2: Understand Tailwind build process

    Changes in tailwind.config.js require restarting the development server to apply.
  3. Final Answer:

    Forgot to restart the development server after config change -> Option A
  4. Quick Check:

    Restart server after config edits [OK]
Hint: Restart dev server after config changes to apply them [OK]
Common Mistakes:
  • Using wrong percentage syntax in keyframes
  • Wrong animation class name format
  • Believing Tailwind can't do custom animations
5. You want to create a custom Tailwind animation that moves an element up 20px and fades it in simultaneously over 1.5 seconds. Which config snippet correctly defines this animation?
hard
A. "extend: { keyframes: { moveUpFadeIn: { '0%': { transform: 'translateY(0)', opacity: '1' }, '100%': { transform: 'translateY(20px)', opacity: '0' } } }, animation: { moveUpFadeIn: 'moveUpFadeIn 1.5s ease-out forwards' } }"
B. "extend: { keyframes: { moveUpFadeIn: { '0%': { transform: 'translateX(20px)', opacity: '1' }, '100%': { transform: 'translateX(0)', opacity: '0' } } }, animation: { moveUpFadeIn: 'moveUpFadeIn 1.5s ease-out forwards' } }"
C. "extend: { keyframes: { moveUpFadeIn: { '0%': { transform: 'translateY(20px)', opacity: '0' }, '100%': { transform: 'translateY(0)', opacity: '1' } } }, animation: { moveUpFadeIn: 'moveUpFadeIn 1.5s ease-out forwards' } }"
D. "extend: { keyframes: { moveUpFadeIn: { '0%': { transform: 'translateY(20px)', opacity: '1' }, '100%': { transform: 'translateY(0)', opacity: '0' } } }, animation: { moveUpFadeIn: 'moveUpFadeIn 1.5s ease-out forwards' } }"

Solution

  1. Step 1: Identify correct transform and opacity start/end values

    Moving up means translateY from 20px (start) to 0 (end). Fading in means opacity from 0 to 1.
  2. Step 2: Match animation timing and properties

    Duration 1.5s, easing ease-out, and forwards to keep final state are correct.
  3. Final Answer:

    extend: { keyframes: { moveUpFadeIn: { '0%': { transform: 'translateY(20px)', opacity: '0' }, '100%': { transform: 'translateY(0)', opacity: '1' } } }, animation: { moveUpFadeIn: 'moveUpFadeIn 1.5s ease-out forwards' } } -> Option C
  4. Quick Check:

    TranslateY 20px to 0 + opacity 0 to 1 = move up fade in [OK]
Hint: Check start/end transform and opacity values carefully [OK]
Common Mistakes:
  • Using translateX instead of translateY for vertical movement
  • Reversing opacity values (fade out instead of fade in)
  • Swapping start and end positions
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard