Complete the code to apply a dark background using Tailwind CSS.
<div class="[1] min-h-screen flex items-center justify-center"> <p class="text-white">Dark mode background</p> </div>
The class bg-gray-900 sets a very dark background color, suitable for dark mode.
Complete the code to make text color adapt to dark mode using Tailwind CSS.
<p class="[1]">This text changes color in dark mode.</p>
The class text-black dark:text-white sets black text normally and white text in dark mode for better readability.
Fix the error in the dark mode toggle button code by completing the missing class.
<button class="px-4 py-2 rounded [1] transition-colors duration-300"> Toggle Dark Mode </button>
The class bg-gray-200 dark:bg-gray-800 changes the button background color based on light or dark mode, improving user experience.
Fill both blanks to create a responsive card with dark mode support.
<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>
The card background uses bg-white dark:bg-gray-900 to switch colors. The heading uses text-gray-900 dark:text-white for readability in both modes.
Fill all three blanks to create a dark mode toggle switch with accessible labels.
<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>
sr-only for accessible hidden input.The label background uses bg-gray-300 dark:bg-gray-600 to adapt to dark mode. The toggle track uses bg-green-400 for the active color, and the dot uses bg-white for contrast and visibility.