Loading tutorials
Intermediate · Mid: 12 chapters · 35 min read. States assumed prerequisites
Start readinghover: and md:. You need a project with Tailwind CSS already installed. Later chapters use JavaScript (the DOM and localStorage), but this one does not.hover: and md:. By the end, you will know what dark: does when you configure nothing, and where that default stops being enough.hover: and md:, and basic JavaScript. It also assumes you have a project with Tailwind installed. Here you will switch the dark: variant from the operating system setting to a setting your page conthover: and md:, and basic JavaScript. It also assumes a project with Tailwind already installed. By the end you will be able to switch the dark: variant from following the operating system to followhover: and md:. It also assumes a project where dark: already works, using either the media strategy or a class or selector strategy.localStorage), and that a Tailwind project is already set up. It also assumes you have read the previous chapters on the dark: variant and on configuring the class or selector strategy. A toggle only works once dark: is dark: utilities already respond to a .dark class on the <html> element. That means you have configured the class or selector strategy from the earlier chapters, in v3 or v4. It also assumes you know the basics of the DOM and localStoragelocalStorage, and basic knowledge of how browsers parse HTML. If the toggle does not work yet, finish that first.dark class strategy from the earlier chapters, and can read basic CSS custom properties. You will move theme colors out of individual dark: classes and into CSS variables, so a single class works in both themes.prefers-color-scheme strategy or a .dark class, and that you know the Tailwind utilities used in earlier chapters. You should also be comfortable with plain CSS custom properties.dark: variant, and have a working class or selector strategy from earlier chapters. You will learn how to check that a dark theme is readable, and how to fix the usual problems.hover: and md: variants, and that you have read the earlier chapters on the media and class strategies. Here you will work through the usual reasons a dark: class has no effect, in the order you should check them.