0
0
Tailwindmarkup~20 mins

Ping animation (notifications) in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Ping Animation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
rendering
intermediate
2:00remaining
What will you see with this Tailwind ping animation code?
Look at this HTML snippet using Tailwind CSS classes for a ping animation on a notification dot. What is the visible effect in the browser?
Tailwind
<div class="relative flex items-center justify-center w-10 h-10 bg-gray-200 rounded-full">
  <span class="absolute inline-flex h-3 w-3 top-1 right-1">
    <span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"></span>
    <span class="relative inline-flex rounded-full h-3 w-3 bg-red-500"></span>
  </span>
</div>
AA small red dot with a fading expanding red circle around it that repeats continuously.
BA static red dot with no animation or movement visible.
CA large red circle that grows and disappears once and then stops.
DA red dot that changes color from red to blue repeatedly.
Attempts:
2 left
💡 Hint
Focus on the animate-ping class and how it affects the inner span.
selector
intermediate
1:30remaining
Which Tailwind class controls the speed of the ping animation?
Given the ping animation uses the class animate-ping, which class would you add or modify to make the ping animation slower?
Aanimate-ping-slow
Bduration-3000
Cspeed-500
Ddelay-200
Attempts:
2 left
💡 Hint
Tailwind uses duration- classes to control animation speed in milliseconds.
🧠 Conceptual
advanced
2:00remaining
Why is the ping animation wrapped in two nested spans in this Tailwind example?
Consider this structure: Why are there two spans inside the outer span?
AThey are duplicates and one can be removed without effect.
BBoth spans create two overlapping ping animations for a stronger effect.
COne span is for accessibility labels, the other for animation.
DOne span creates the expanding ping effect, the other is the solid dot on top.
Attempts:
2 left
💡 Hint
Think about layering and how animations and static elements combine visually.
accessibility
advanced
2:00remaining
How to improve accessibility for a ping notification dot in Tailwind?
You have a red ping dot indicating new notifications. Which addition improves screen reader accessibility?
Tailwind
<span class="relative inline-flex h-3 w-3 rounded-full bg-red-500"></span>
AAdd alt="Red dot" attribute to the span.
BAdd tabindex="-1" to make it focusable.
CAdd aria-label="New notifications" and role="status" to the span.
DNo changes needed; color alone is enough.
Attempts:
2 left
💡 Hint
Think about how screen readers get information about visual indicators.
layout
expert
2:30remaining
How to position a ping notification dot at the top-right corner of a profile picture using Tailwind?
You have a profile picture inside a div with class "relative w-16 h-16 rounded-full overflow-hidden". Which code snippet correctly places a ping dot at the top-right corner overlapping the picture?
A
&lt;span class="absolute top-0 right-0 h-4 w-4"&gt;
  &lt;span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"&gt;&lt;/span&gt;
  &lt;span class="relative inline-flex rounded-full h-4 w-4 bg-green-500"&gt;&lt;/span&gt;
&lt;/span&gt;
B
&lt;span class="relative top-0 right-0 h-4 w-4"&gt;
  &lt;span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"&gt;&lt;/span&gt;
  &lt;span class="relative inline-flex rounded-full h-4 w-4 bg-green-500"&gt;&lt;/span&gt;
&lt;/span&gt;
C
&lt;span class="fixed top-0 right-0 h-4 w-4"&gt;
  &lt;span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"&gt;&lt;/span&gt;
  &lt;span class="relative inline-flex rounded-full h-4 w-4 bg-green-500"&gt;&lt;/span&gt;
&lt;/span&gt;
D
&lt;span class="absolute bottom-0 left-0 h-4 w-4"&gt;
  &lt;span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"&gt;&lt;/span&gt;
  &lt;span class="relative inline-flex rounded-full h-4 w-4 bg-green-500"&gt;&lt;/span&gt;
&lt;/span&gt;
Attempts:
2 left
💡 Hint
Remember the parent div is relative, so use absolute positioning on the dot.