I would like to create a dark mode and other color filters for my application.
Therefore I tried to apply this css filter to body
filter: invert(1);
But I will break the positioning of fixed elements. I already found this stackoverflow question to it
But when I set the filter directly to the elements and not the containers I cannot set the color for the body and to really add a good dark mode to my application I need it.
How can I accomplish that?
Update 1:
Here is a little a example I just created:
As in the other stackoverflow problem I posted, it's working with Chrome but not Firefox
body, html {
padding: 0;
background: white;
height: 100%;
}
html {
filter: invert(1);
}
body {
padding-bottom: 300px;
}
.container {
position: fixed;
left: 50px;
bottom: 50px;
background: green;
height: 100px;
width: 100px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="./darkmode.css">
</head>
<body>
<div class="container"></div>
</body>
</html>
Greetings, Markus