Checkbox to toggle switch

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Checkbox to Toggle Switch in CSS</title>
        body {
            background-color: #383838;

        div.container {
            width: 100%;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;

        input[type=checkbox] {
            font-size: 30px;
            appearance: none;
            width: 150px;
            height: 55px;
            background-color: #ddd;
            border-radius: 85px;
            position: relative;
            cursor: pointer;
            outline: none;
            transition: 0.2s all ease-in-out;

        input[type=checkbox]:checked {
            background-color: #0ebeff;

        input[type=checkbox]::after {
            position: absolute;
            content: "";
            width: 55px;
            height: 55px;
            border-radius: 100%;
            background-color: #fff;
            box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
            transform: scale(0.7);
            left: 0;
            transition: 0.2s all ease-in-out;

        input[type=checkbox]:checked:after {
            left: calc(100% - 55px);
    <div class="container">
        <input type="checkbox" name="" id="">
                                Copy Code