Search
 
SCRIPT & CODE EXAMPLE
 

HTML

how to make a dark mode html

<!DOCTYPE html>
<html>
    <head><title>How to Dark Mode in HTML5</title></head>
    <body>
        <button onclick="darkMode()">Click me</button>
    </body>
    <script>
        function darkMode() {
            if (document.body.style.backgroundColor == "black") {
                document.body.style.backgroundColor = "white";
            } else {
                document.body.style.backgroundColor = "black";
            }
            console.log(document.body.style.backgroundColor);   // ctrl + j and you can see which mode you're in
        }
    </script>
</html>
Comment

easy ways to implement dark mode html css

<meta name="color-scheme" content="dark light">
Comment

easy ways to implement dark mode html css

<meta name="color-scheme" content="dark light">
Comment

PREVIOUS NEXT
Code Example
Html :: how to stop button from affecting form submit in html 
Html :: mpdf table font size problem 
Html :: how to make dropdown in html 
Html :: markdown dropdown 
Html :: how to set a default value for a dropdownlist in html with thymeleaf spring 
Html :: vue submit reloads page 
Html :: ol list 
Html :: square div 
Html :: html5 iframe youtube loop 
Html :: button as href 
Html :: displa text in html 
Html :: mat tab badge 
Html :: html href click not refresh 
Html :: how to embed python in html 
Html :: bootstrap colored link 
Html :: disable form input autocomplete 
Html :: fa fa dropdown icon 
Html :: predefine data list in input 
Html :: applying padding increases the size of the element 
Html :: font awesome tag 
Html :: html strong 
Html :: Tailwind CSS rating stars 
Html :: html input submit size width 
Html :: yes no checkbox css 
Html :: did not expect server html to contain a div in div 
Html :: how to link js to html 
Html :: html multiplication 
Html :: ion input form autocomplete 
Html :: lorem ipsum hebrew 
Html :: bootstrap table dense 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =