Answers for "css get dark mode"

3

dark mode css

body {
  background-color: black;
  color: white;
}

@media screen and (prefers-color-scheme: light) {
  body {
    background-color: white;
    color: black;
  }
}
Posted by: Guest on March-18-2020
1

css dark mode

@media (prefers-color-scheme: dark) {
  body {
    background-color: black;
    color: white;
  }
}
Posted by: Guest on September-25-2020
0

css get dark mode

<!DOCTYPE html>
<html>
<head>
<style>
body.dark-mode {
  background-color: black;
  color: white;
}

@media screen and (prefers-color-scheme: light) {
  body.dark-mode {
    background-color: unset;
    color: unset;
  }
}
</style>
</head>
<body class="dark-mode">

<p>Text</p>

</body>
</html>
Posted by: Guest on September-24-2021

Browse Popular Code Answers by Language