Dark Day Mode

<!DOCTYPE html>
<html>
<head>
<style type="text/css">
*{
box-sizing:border-box;
margin:0;
padding:0;
}

*:focus{
outline:110px;
}

body{
background-color:teal;
align-items: center;
display:flex;
justify-content:center;
min-height:100vh;
}

input[type="checkbox"] {
appearance:none;
display:none;
visibility:hidden;
}

input[type="checkbox"]:checked ~.check:before{
transform:translateX(-50px);
}

input[type="checkbox"]:checked ~.check{
background-color:orange;
box-shadow: 0 0 0 5000px #092c3e;      /*This changes the background color(actually it is changing box shadow but due to high spread it covers all) */
}

input[type="checkbox"]:checked ~ .check:after{
transform:translateX(0px);
}



.check:before,
.check:after{
border-radius:50%;
content:' ';
height:16px;
top:2px;
position:absolute;
transition:transform 0.5s ease;
width:16px;
}



.check:before{
background-color:#ffffff;
left:2px;
}


.check{
background-color: red;
border-radius:20px;
cursor:pointer;
display:block;
height:20px;
overflow:hidden;
position:relative;
transition:background-color 0.5s ease-in,
           box-shadow 0.5s ease-in;
width:40px;
}

.check:after{
background-color:#092c3e;
right:2px;
transform:translateX(50px); 
}



</style>
<title></title>
</head>
<body>
<label>
<input type="checkbox">
<span class="check"></span>
</label>
<script type="text/javascript">

</script>
</body>
</html>

Comments