
Light and Dark mode in 2 lines CSS!
You can now create light and dark mode with just 2 Iines of CSS! This is a game changer for anyone who has tried to create light and dark mode before, writing lots of lots of code for your apps to turn to a darker theme, when viewed in dark mode on your operating system - or of course turn to lighter colours, when viewed in light mode.
Now by using the light-dark method in css, you can pass through a light colour of your choice, and a dark colour of your choice! You can do so for many elements, such as the body element right here. All the first arguments will be lumped into your light mode theme. Just make sure to set the root also.
And voila! Get the HTML and CSS from below and don’t forget to save this tip and follow for more.
Since May 2024, this feature works across the latest devices and browser versions.
Now by using the light-dark method in css, you can pass through a light colour of your choice, and a dark colour of your choice! You can do so for many elements, such as the body element right here. All the first arguments will be lumped into your light mode theme. Just make sure to set the root also.
And voila! Get the HTML and CSS from below and don’t forget to save this tip and follow for more.
Since May 2024, this feature works across the latest devices and browser versions.
Code with Ania Kubów
Hello everyone.
My name is Ania Kubow and I am a Software Developer (ex-Eurostar) who quit the rat race to focus on my channel and teach others how to code by building retro Games and awesome projects. I am also part of the core team @FreeCodeCamp. You ...