Changing the ui state without using js

 Lets say you have a button which sets the dark mode, how do you react to the change without using js ?

<!DOCTYPE html>
<html lang="en">
.trigger:checked + .area {
background-color: red;

.area {
height: 300px;
width: 300px;
background-color: black;
<meta charset="UTF-8">

<input type="checkbox" class="trigger" />
<div class="area">

The above code does the same. It uses the :checked state to modify the other classes.



Post a Comment