+ 4
First try self.
12th Jan 2023, 3:18 PM
A͢J
A͢J - avatar
+ 7
Then learn other things
12th Jan 2023, 3:24 PM
A͢J
A͢J - avatar
+ 1
12th Jan 2023, 5:53 PM
arturop200
arturop200 - avatar
0
Here is an example of how you can create a light/dark mode toggle switch using JavaScript: // Get the checkbox element let checkbox = document.querySelector('input[name=mode]'); // Function to toggle light and dark mode function switchTheme(e) { if (e.target.checked) { document.documentElement.setAttribute('data-theme', 'dark'); } else { document.documentElement.setAttribute('data-theme', 'light'); } } // Event Listener on checkbox change checkbox.addEventListener('change', switchTheme, false);
12th Jan 2023, 3:36 PM
Reza Mardani
Reza Mardani - avatar
0
It is not possible with only HTML. HTML is for page structure. You must learn CSS to change the color. And JS to add the interactive element that will let you switch between colors.
14th Jan 2023, 9:17 PM
Chris Coder
Chris Coder - avatar