0
0
Tailwindmarkup~10 mins

Why dark mode improves user experience in Tailwind - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to apply a dark background using Tailwind CSS.

Tailwind
<div class="[1] min-h-screen flex items-center justify-center">
  <p class="text-white">Dark mode background</p>
</div>
Drag options to blanks, or click blank then click option'
Abg-blue-500
Bbg-yellow-300
Cbg-white
Dbg-gray-900
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a light background class like bg-white.
Using a bright color that is not suitable for dark mode.
2fill in blank
medium

Complete the code to make text color adapt to dark mode using Tailwind CSS.

Tailwind
<p class="[1]">This text changes color in dark mode.</p>
Drag options to blanks, or click blank then click option'
Atext-black dark:text-white
Btext-white dark:text-black
Ctext-gray-500
Dtext-yellow-400
Attempts:
3 left
💡 Hint
Common Mistakes
Reversing the colors so text is white on light background.
Not using the dark: prefix.
3fill in blank
hard

Fix the error in the dark mode toggle button code by completing the missing class.

Tailwind
<button class="px-4 py-2 rounded [1] transition-colors duration-300">
  Toggle Dark Mode
</button>
Drag options to blanks, or click blank then click option'
Abg-gray-200 dark:bg-gray-800
Bbg-red-500
Ctext-blue-700
Dborder-2 border-black
Attempts:
3 left
💡 Hint
Common Mistakes
Using a fixed color that does not change with dark mode.
Forgetting to add transition classes for smooth color change.
4fill in blank
hard

Fill both blanks to create a responsive card with dark mode support.

Tailwind
<div class="max-w-sm rounded overflow-hidden shadow-lg [1] p-6">
  <h2 class="font-bold text-xl mb-2 [2]">Dark Mode Card</h2>
  <p>This card adapts to dark mode and screen size.</p>
</div>
Drag options to blanks, or click blank then click option'
Abg-white dark:bg-gray-900
Btext-gray-900 dark:text-white
Ctext-white
Dbg-gray-300
Attempts:
3 left
💡 Hint
Common Mistakes
Using fixed colors that don't adapt to dark mode.
Not using dark mode classes for text.
5fill in blank
hard

Fill all three blanks to create a dark mode toggle switch with accessible labels.

Tailwind
<label for="dark-toggle" class="flex items-center cursor-pointer [1]">
  <div class="relative">
    <input type="checkbox" id="dark-toggle" class="sr-only" />
    <div class="w-10 h-4 [2] rounded-full shadow-inner"></div>
    <div class="dot absolute w-6 h-6 [3] rounded-full shadow -left-1 -top-1 transition"></div>
  </div>
  <span class="ml-3 text-gray-700 dark:text-gray-300">Dark Mode</span>
</label>
Drag options to blanks, or click blank then click option'
Abg-gray-300 dark:bg-gray-600
Bbg-green-400
Cbg-white
Dbg-black
Attempts:
3 left
💡 Hint
Common Mistakes
Not using sr-only for accessible hidden input.
Using colors that don't contrast well in dark mode.