A short CSS tutorial showing how to toggle dark mode, light mode and themes using the :has() selector with only HTML and CSS, no JavaScript. It assumes familiarity with writing HTML and CSS.
What you’ll learn
✓Build a dark mode toggle using the CSS :has() selector
✓Switch themes with HTML and CSS alone, without JavaScript
✓Apply a theme toggle to a Webflow or other web page