<body>
    <label>
        <input type="checkbox">
        <span>
            <i></i>
        </span>
    </label>
</body>
*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

label{
    position: relative;
    width: 160px;
    height: 80px;
    cursor: pointer;
}

label input{
    position: relative;
    z-index: 1;
    appearance: none;
}

label span{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fe0000;
    border-radius: 80px;
    transition: 0.5s;
    box-shadow: 0 15px 25px #fe000066;
}

label input:checked ~ span{
    background: #05be05;
    box-shadow: 0 15px 25px #05be0566;
}

label span i{
    position: absolute;
    top: 4px;
    left: 4px;
    width: 72px;
    height: 72px;
    background: #fff;
    border-radius: 50%;
    transition: 0.5s;
}

label input:checked ~ span i{
    left: 84px;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.