0
0
Tailwindmarkup~20 mins

Alert and notification patterns in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Alert Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
rendering
intermediate
2:00remaining
Rendering a success alert with Tailwind CSS
Which option correctly renders a green success alert with accessible roles and proper padding using Tailwind CSS?
A<div class="bg-green-500 text-white p-2 rounded">Success! Your action was completed.</div>
B<div role="alert" class="bg-green-200 text-green-900 p-1 rounded">Success! Your action was completed.</div>
C<div role="alert" class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded relative" aria-live="polite">Success! Your action was completed.</div>
D<div role="alert" class="bg-green-100 border-green-400 text-green-700 px-4 py-3 rounded">Success! Your action was completed.</div>
Attempts:
2 left
💡 Hint
Look for the option that uses role="alert" and includes padding and border classes for a clear alert box.
selector
intermediate
2:00remaining
Selecting the correct Tailwind class for a dismissible alert close button
Which Tailwind CSS class combination is best for a close button inside an alert to ensure it is keyboard accessible and visually clear?
Afocus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 text-red-700 hover:text-red-900
Bhover:bg-red-700 text-white p-1 rounded cursor-pointer
Ctext-red-500 cursor-pointer
Dfocus:ring-4 focus:ring-red-300 rounded-full p-2 text-red-600
Attempts:
2 left
💡 Hint
Focus styles help keyboard users see the button is focused.
🧠 Conceptual
advanced
1:30remaining
Understanding ARIA roles in alert notifications
What is the main purpose of adding role="alert" to an alert notification in HTML?
AIt styles the alert with a red background automatically.
BIt hides the alert from screen readers to avoid distraction.
CIt delays the alert announcement until the user focuses on it.
DIt makes the alert content immediately announced by screen readers without user interaction.
Attempts:
2 left
💡 Hint
Think about how screen readers handle urgent messages.
layout
advanced
2:30remaining
Creating a responsive notification banner with Tailwind CSS
Which option correctly uses Tailwind CSS to create a notification banner that is horizontally centered, has space between icon and text, and stacks vertically on small screens?
A<div class="flex flex-col sm:flex-row items-center justify-center gap-4 bg-blue-100 p-4 rounded"> <svg class="w-6 h-6 text-blue-600"></svg> <p class="text-blue-800">This is a notification banner.</p> </div>
B<div class="flex items-center justify-center gap-4 bg-blue-100 p-4 rounded"> <svg class="w-6 h-6 text-blue-600"></svg> <p class="text-blue-800">This is a notification banner.</p> </div>
C<div class="flex flex-row items-center justify-center gap-4 bg-blue-100 p-4 rounded"> <svg class="w-6 h-6 text-blue-600"></svg> <p class="text-blue-800">This is a notification banner.</p> </div>
D<div class="block sm:flex items-center justify-center gap-4 bg-blue-100 p-4 rounded"> <svg class="w-6 h-6 text-blue-600"></svg> <p class="text-blue-800">This is a notification banner.</p> </div>
Attempts:
2 left
💡 Hint
Use flex direction column by default (small screens) and row on larger screens (sm:).
accessibility
expert
3:00remaining
Ensuring accessible live region updates for dynamic alerts
You have a notification area that updates dynamically with new alerts. Which ARIA attribute combination ensures screen readers announce new alerts only when they appear, without repeating old alerts?
Aaria-live="off" aria-atomic="true"
Baria-live="polite" aria-atomic="true"
Caria-live="polite" aria-atomic="false"
Daria-live="assertive" aria-atomic="false"
Attempts:
2 left
💡 Hint
Consider polite announcements and whole region updates.