0
0
Tailwindmarkup~5 mins

Media-based dark mode strategy in Tailwind - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the media-based dark mode strategy use to switch themes?
It uses the user's system preference detected by the prefers-color-scheme media query to automatically switch between light and dark themes.
Click to reveal answer
beginner
How do you enable dark mode in Tailwind CSS using media queries?
Set darkMode: 'media' in the Tailwind config file. This tells Tailwind to apply dark styles when the user's system prefers dark mode.
Click to reveal answer
beginner
Which CSS media feature detects if a user prefers dark mode?
The media feature is prefers-color-scheme: dark. It matches when the user’s system is set to dark mode.
Click to reveal answer
beginner
How do you write a Tailwind class that applies only in dark mode with media strategy?
Prefix the class with <code>dark:</code>. For example, <code>dark:bg-gray-900</code> sets a dark background only when dark mode is active.
Click to reveal answer
beginner
Why is media-based dark mode strategy user-friendly?
Because it respects the user's system preference automatically, so the website matches their chosen theme without extra settings.
Click to reveal answer
Which Tailwind config option enables media-based dark mode?
A"darkMode: true"
B"darkMode: 'media'"
C"darkMode: 'class'"
D"darkMode: 'auto'"
What CSS media query detects dark mode preference?
A@media (theme: dark)
B@media (dark-mode: on)
C@media (color-scheme: dark)
D@media (prefers-color-scheme: dark)
How do you apply a background color only in dark mode using Tailwind?
Adark:bg-gray-900
Bbg-dark-gray
Cdarkmode:bg-gray-900
Dbg-gray-900-dark
What happens if a user’s system is set to light mode with media-based dark mode?
ADark styles are applied
BNo styles are applied
CLight styles are applied
DUser is asked to choose
Which is a benefit of media-based dark mode strategy?
AAutomatically matches system theme
BWebsite ignores user preference
CRequires JavaScript to work
DUser must toggle theme manually
Explain how media-based dark mode strategy works in Tailwind CSS.
Think about how the website knows when to show dark styles.
You got /4 concepts.
    Describe the advantages of using media-based dark mode strategy for users.
    Consider what users want from theme switching.
    You got /4 concepts.