I'm in the process of implementing a dark mode feature on my website, and I want to do it without using any boilerplate code.
My plan is to create a .darkmode class in CSS, apply styles to it, and have JavaScript add the darkmode class to the <body>
element when the user activates dark mode.
Is there a way to achieve this with CSS?
.darkmode {
.content{
background-color: black;
}
input{
background-color: black;
}
}
Essentially, I'm wondering how I can use CSS to change various elements on the page when the darkmode class is added to the <body>
.