Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container">
    <h2>TOGGLE ONE</h2>
    <label class="toggle one">
        <input type="checkbox">
        <span class="slider"></span>
    </label>
</div>

<div class="container">
    <h2>TOGGLE TWO</h2>
    <label class="toggle two">
        <input type="checkbox">
        <span class="slider"></span>
    </label>
</div>

<div class="container">
    <h2>TOGGLE THREE</h2>
    <label class="toggle three">
        <input type="checkbox">
        <span class="slider"></span>
    </label>
</div>

<div class="container">
    <h2>TOGGLE FOUR</h2>
    <label class="toggle four">
        <input type="checkbox">
        <span class="slider"></span>
    </label>
</div>

<div class="container">
    <h2>TOGGLE FIVE</h2>
    <label class="toggle five">
        <input type="checkbox">
        <span class="slider"></span>
    </label>
</div>

<div class="container">
    <h2>TOGGLE SIX</h2>
    <label class="toggle six">
        <input type="checkbox">
        <span class="slider"></span>
    </label>
</div>

<div class="container">
    <h2>TOGGLE SEVEN</h2>
    <label class="toggle seven">
        <input type="checkbox">
        <span class="slider"></span>
    </label>
</div>

<div class="container">
    <h2>TOGGLE EIGHT</h2>
    <label class="toggle eight">
        <input type="checkbox">
        <span class="slider"></span>
    </label>
</div>

<div class="container">
    <h2>TOGGLE NINE</h2>
    <label class="toggle nine">
        <input type="checkbox">
        <span class="slider"></span>
    </label>
</div>

<div class="container">
    <h2>TOGGLE TEN</h2>
    <label class="toggle ten">
        <input type="checkbox">
        <span class="slider"></span>
        <span class="light"></span>
    </label>
</div>

<div class="container">
    <h2>TOGGLE ELEVEN</h2>
    <label class="toggle eleven">
        <input type="checkbox">
        <span class="slider"></span>
        <span class="light"></span>
    </label>
</div>

<div class="container">
    <h2>TOGGLE TWELVE</h2>
    <label class="toggle twelve">
        <input type="checkbox">
        <span class="slider"></span>
    </label>
</div>

<div class="container">
    <h2>TOGGLE THIRTEEN</h2>
    <label class="toggle thirteen">
        <input type="checkbox">
        <span class="slider"></span>
    </label>
</div>

<div class="container">
    <h2>TOGGLE FOURTEEN</h2>
    <label class="toggle fourteen">
        <input type="checkbox">
        <span class="slider"></span>
        <span class="light"></span>
    </label>
</div>

<div class="container">
    <h2>TOGGLE FIFTEEN</h2>
    <label class="toggle fifteen">
        <input type="checkbox">
        <span class="slider"></span>
        <span class="light"></span>
    </label>
</div>

<div class="container">
    <h2>TOGGLE SIXTEEN</h2>
    <label class="toggle sixteen">
        <input type="checkbox">
        <span class="slider"></span>
        <span class="light"></span>
    </label>
</div>
              
            
!

CSS

              
                *,
*::before,
*::after {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}
body,
html {
    height: 100vh;
}
body {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    background: #4c5c68;
}

// TOOGLE //
.container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    height: 100%;
    position: relative;

    h2 {
        color: darken(#4c5c68, 10);
        text-shadow: 0 1px 1px lighten(#4c5c68, 5);
        font-size: 14px;
        margin-bottom: 1rem;
    }

    // GENERAL TOGGLE VALUES & SETTINGS //
    $width: 80px;
    $bg: #4c5c68;
    $transition: all 0.2s ease-in-out;
    $green: limegreen;
    $red: tomato;
    $font-size: #{$width / 7};

    .toggle {
        position: relative;
        width: $width;
        height: $width / 2;
        cursor: pointer;

        input {
            display: none;
        }

        .slider {
            // flex style
            display: flex;
            justify-content: center;
            align-items: center;
            // grid style
            // display: grid;
            // place-items: center;
            position: absolute;
            top: 2px;
            left: 2px;
            width: $width / 2 - 4px;
            height: $width / 2 - 4px;
            transition: $transition;
        }
    }

    // TOGGLE ONE //
    .toggle.one {
        border-radius: $width / 4;
        border: 1px solid lighten($bg, 10);
        background: linear-gradient(180deg, darken($bg, 16), lighten($bg, 8));
        box-shadow: inset 0 0 8px rgba(black, 0.75);

        .slider {
            border-radius: 50%;
            border: 2px solid darken($bg, 10);
            box-shadow: 0 0 8px rgba(black, 0.5);
            background: $red;
            color: darken($bg, 10);
            z-index: 1;

            &::before {
                content: "OFF";
                font-size: $font-size;
                font-weight: bold;
            }
        }
        input:checked + .slider {
            transform: translateX(calc(100% + 4px)) rotate(360deg);
            background: $green;

            &::before {
                content: "ON";
            }
        }
    }

    // TOGGLE TWO //
    .toggle.two {
        background: darken($bg, 10);

        &::before,
        &::after {
            position: absolute;
            top: 0;
            bottom: 0;
            width: 50%;
            font-size: $font-size;
            line-height: $width / 2;
            text-align: center;
            font-weight: bold;
        }
        &::before {
            left: 0;
            content: "ON";
            color: $green;
        }
        &::after {
            right: 0;
            content: "OFF";
            color: $red;
        }

        .slider {
            background: $red;
            border: 2px solid darken($bg, 10);
            z-index: 1;
        }
        input:checked + .slider {
            transform: translateX(calc(100% + 4px));
            background: $green;
        }
    }

    // TOGGLE THREE //
    .toggle.three {
        &::before,
        &::after {
            position: absolute;
            top: 0;
            bottom: 0;
            width: 50%;
            background: darken($bg, 10);
            font-size: $font-size;
            line-height: $width / 2;
            text-align: center;
            font-weight: bold;
        }
        &::before {
            content: "ON";
            color: $green;
            left: 0;
            border-radius: 50% 35% 35% 50%;
        }
        &::after {
            content: "OFF";
            color: $red;
            right: 0;
            border-radius: 35% 50% 50% 35%;
        }

        .slider {
            background: $red;
            border: 2px solid darken($bg, 10);
            border-radius: 50% 35% 35% 50%;
            z-index: 1;
        }
        input:checked + .slider {
            transform: translateX(calc(100% + 4px)) rotateX(180deg);
            background: $green;
            border-radius: 35% 50% 50% 35%;
        }
    }

    // TOGGLE FOUR //
    .toggle.four {
        background: darken($bg, 10);
        border-radius: 8px;
        perspective: 600px;

        .slider {
            background: $red;
            border-radius: 6px 0 0 6px;
            border: 2px solid darken($bg, 10);
            border-right: none;
        }

        input:checked + .slider {
            transform: translateX(calc(100% + 4px)) rotateY(180deg);
            background: $green;
        }
    }

    // TOGGLE FIVE //
    .toggle.five {
        .slider {
            width: 100%;
            height: 100%;
            background: $red;
            box-shadow: inset 0 0 10px darken($red, 20);
            border-radius: $width / 4;
            border: 4px solid darken($bg, 10);
            box-shadow: inset 0 0 10px rgba(black, 0.75);

            &::before,
            &::after {
                content: "";
                position: absolute;
                height: calc(100% - 4px);
                top: 2px;
                border-radius: 50%;
                transition: $transition;
            }
            &::before {
                left: 2px;
                width: calc(50% - 8px);
                background: darken($bg, 10);
                box-shadow: inset 0 0 0 6px darken($bg, 10),
                    inset 0 0 0 8px var(--border, tomato);
                z-index: 1;
            }
            &::after {
                content: "OFF";
                color: darken($bg, 10);
                font-size: $font-size;
                line-height: $width / 2 - 12;
                font-weight: bold;
                text-align: center;
                right: 4px;
                width: 50%;
            }
        }
        input:checked + .slider {
            background: $green;
            box-shadow: inset -3px -3px 10px lighten($green, 30),
                inset 3px 3px 10px darken($green, 30);
            &::before {
                --border: limegreen;
                transform: translateX(calc(100% + 12px));
            }
            &::after {
                content: "ON";
                transform: translateX(calc(-100% + 10px));
            }
        }
    }

    // TOGGLE SIX //
    .toggle.six {
        $br: $width / 6;
        border-radius: $br;
        border: 1px solid lighten($bg, 10);
        background: linear-gradient(145deg, darken($bg, 10), lighten($bg, 10));
        box-shadow: inset 0 0 8px rgba(black, 0.75);

        &::before,
        &::after {
            position: absolute;
            top: 0;
            width: 50%;
            line-height: $width / 2;
            text-align: center;
            font-size: $font-size;
            font-weight: bold;
        }
        &::before {
            left: 0;
            content: "ON";
            color: $green;
        }
        &::after {
            right: 0;
            content: "OFF";
            color: $red;
        }

        .slider {
            height: calc(100% - 4px);
            width: 50%;
            border-radius: $br - 2;
            border: 1px solid lighten($bg, 10);
            background: linear-gradient(
                to top,
                darken($bg, 10),
                lighten($bg, 10)
            );
            box-shadow: 0 0 5px rgba(black, 0.5);
            z-index: 1;

            &::before {
                content: "";
                height: 16px;
                width: 16px;
                border-radius: 8px;
                background: $red;
                border: 2px solid lighten($bg, 10);
                box-shadow: inset 0 0 3px rgba(black, 0.75);
            }
        }
        input:checked + .slider {
            transform: translateX(calc(100% - 4px));
            &::before {
                background: $green;
            }
        }
    }

    // TOGGLE SEVEN //
    .toggle.seven {
        &::before {
            content: "";
            position: absolute;
            top: -5px;
            bottom: -5px;
            left: -5px;
            right: -5px;
            border-radius: $width / 2 + 10;
            background: linear-gradient(
                180deg,
                darken($bg, 16),
                lighten($bg, 8)
            );
        }

        .slider {
            left: 0;
            width: 100%;
            background: darken($bg, 10);
            border-radius: $width / 2;
            box-shadow: inset 0 0 8px rgba(black, 0.75);

            &::before,
            &::after {
                position: absolute;
                top: 0;
                left: 0;
                font-weight: bold;
                text-align: center;
                border-radius: 50%;
                width: $width / 2 - 2;
                height: 100%;
                transition: $transition;
            }
            &::before {
                content: "|||";
                color: $bg;
                text-shadow: 1px 1px 1px lighten($bg, 20);
                line-height: $width / 2 - 14;
                border: 4px solid darken($bg, 8);
                background: lighten($bg, 10);
                box-shadow: 0 0 5px rgba(black, 0.5);
                z-index: 1;
            }

            &::after {
                content: "OFF";
                position: absolute;
                color: $red;
                text-shadow: 0 0 5px $red;
                font-size: $font-size;
                line-height: $width / 2 - 4;
                right: 2px;
                left: auto;
                width: 50%;
            }
        }
        input:checked + .slider {
            &::before {
                transform: translateX(calc(100% + 4px));
            }
            &::after {
                content: "ON";
                color: $green;
                text-shadow: 0 0 5px $green;
                transform: translateX(calc(-100% + 4px));
            }
        }
    }

    // TOGGLE EIGHT //
    .toggle.eight {
        .slider {
            width: 100%;
            background: darken($bg, 10);
            border: 2px solid lighten($bg, 10);
            transform: skew(10deg);
            box-shadow: inset 0 0 10px rgba(black, 0.75);

            &::before,
            &::after {
                position: absolute;
                top: 0;
                bottom: 0;
                width: 50%;
                text-align: center;
                font-weight: bold;
                transition: $transition;
            }
            &::before {
                content: "| | |";
                color: darken($bg, 10);
                text-shadow: 1px 1px 1px lighten($bg, 5);
                text-align: center;
                line-height: $width / 4 + 3;
                left: 0;
                background: lighten($bg, 10);
                border: 4px solid darken($bg, 14);
                z-index: 1;
            }
            &::after {
                right: 2px;
                content: "OFF";
                color: $red;
                line-height: $width / 2 - 4;
                font-size: $font-size;
            }
        }
        input:checked + .slider {
            transform: skew(-10deg);
            &::before {
                transform: translateX(100%);
            }
            &::after {
                content: "ON";
                color: $green;
                transform: translateX(calc(-100% + 4px));
            }
        }
    }

    // TOOGLE NINE //
    .toggle.nine {
        background: darken($bg, 10);

        &::before,
        &::after,
        .slider::before,
        .slider::after {
            content: "";
            position: absolute;
            border-style: solid;
        }
        &::before {
            left: -10px;
            border-width: #{$width / 4} 10px #{$width / 4} 0;
            border-color: transparent darken($bg, 10) transparent transparent;
        }
        &::after {
            right: -10px;
            border-width: #{$width / 4} 0 #{$width / 4} 10px;
            border-color: transparent transparent transparent darken($bg, 10);
        }

        .slider {
            top: 4px;
            left: 3px;
            height: calc(100% - 8px);
            background: $red;
            z-index: 1;
            transition: $transition;

            &::before,
            &::after {
                transition: $transition;
            }

            &::before {
                left: -8px;
                border-width: #{$width / 4 - 4} 8px #{$width / 4 - 4} 0;
                border-color: transparent $red transparent transparent;
            }
            &::after {
                right: -8px;
                border-width: #{$width / 4 - 4} 0 #{$width / 4 - 4} 8px;
                border-color: transparent transparent transparent $red;
            }
        }
        input:checked + .slider {
            transform: translateX(calc(100% + 3px));
            background: $green;
            &::before {
                border-color: transparent $green transparent transparent;
            }
            &::after {
                border-color: transparent transparent transparent $green;
            }
        }
    }

    // TOGGLE TEN //
    .toggle.ten {
        &::before {
            content: "";
            position: absolute;
            top: -5px;
            bottom: -5px;
            left: -5px;
            right: -5px;
            border-radius: $width / 2 + 10;
            background: linear-gradient(
                0deg,
                darken($bg, 14),
                lighten($bg, 10)
            );
        }

        .light {
            display: flex;
            align-items: center;
            position: absolute;
            width: 100%;
            height: 100%;

            &::before,
            &::after {
                content: "";
                position: absolute;
                width: 12px;
                height: 12px;
                border-radius: 50%;
                border: 2px solid darken($bg, 10);
                transition: $transition;
            }
            &::before {
                left: 12%;
                background: linear-gradient(
                    180deg,
                    lighten($red, 12),
                    darken($red, 12)
                );
                box-shadow: 0 0 10px $red;
            }
            &::after {
                right: 12%;
                background: linear-gradient(
                    180deg,
                    lighten($bg, 8),
                    darken($bg, 12)
                );
            }
        }

        .slider {
            left: 0;
            width: 100%;
            border-radius: $width / 4;
            background: linear-gradient(
                90deg,
                $bg 20%,
                lighten($bg, 4) 50%,
                lighten($bg, 10) 51%,
                lighten($bg, 20)
            );
            border: 2px solid darken($bg, 15);
            box-shadow: 5px 0 3px rgba(black, 0.4);
            transition: all 0.3s ease;

            &::before,
            &::after {
                position: absolute;
                content: "";
                left: 0;
                top: 0;
                height: 100%;
                width: 100%;
                border-radius: $width / 4;
            }

            &::before {
                border-right: 4px solid $red;
                border-left: 2px solid lighten($bg, 5);
                transition: $transition;
            }
            &::after {
                top: 1px;
                left: 4px;
                width: calc(100% - 8px);
                background-image: radial-gradient($bg 1px, transparent 1px);
                background-size: 6px 6px;
                opacity: 0.5;
            }
        }
        input:checked {
            + .slider {
                box-shadow: -5px 0 3px rgba(black, 0.4);
                background: linear-gradient(
                    -90deg,
                    $bg 20%,
                    lighten($bg, 4) 50%,
                    lighten($bg, 10) 51%,
                    lighten($bg, 20)
                );
                &::before {
                    border-right: 2px solid lighten($bg, 5);
                    border-left: 4px solid $green;
                }
            }
            ~ .light {
                &::before {
                    background: linear-gradient(
                        180deg,
                        lighten($bg, 8),
                        darken($bg, 12)
                    );
                    box-shadow: none;
                }

                &::after {
                    background: linear-gradient(
                        180deg,
                        lighten($green, 12),
                        darken($green, 12)
                    );
                    box-shadow: 0 0 10px $green;
                }
            }
        }
    }

    // TOGGLE ELEVEN //
    .toggle.eleven {
        &::before {
            content: "";
            position: absolute;
            top: -5px;
            bottom: -5px;
            left: -5px;
            right: -5px;
            border-radius: $width / 2 + 10;
            background: linear-gradient(
                180deg,
                darken($bg, 16),
                lighten($bg, 8)
            );
        }

        .slider {
            display: flex;
            align-items: center;
            left: 0;
            width: 100%;
            border-radius: $width / 2;
            background: linear-gradient(
                180deg,
                darken($bg, 10),
                lighten($bg, 8),
                darken($bg, 10)
            );
            box-shadow: 0 0 1px 2px darken($bg, 15);

            &::before,
            &::after {
                content: "";
                position: absolute;
                left: 4px;
                height: calc(100% - 4px);
                width: calc(50% - 6px);
                border-radius: 50%;
                z-index: 1;
                transition: $transition;
            }
            &::before {
                background: linear-gradient(
                    180deg,
                    darken($bg, 10),
                    lighten($bg, 10),
                    darken($bg, 10)
                );
                box-shadow: 3px 0 5px rgba(black, 0.5),
                    -3px 0 5px rgba(black, 0.5);
                border-left: 2px solid transparent;
                border-right: 2px solid rgba($red, 0.75);
            }
            &::after {
                background-image: radial-gradient($bg 1px, transparent 1px);
                background-size: 6px 6px;
            }
        }
        .light {
            display: flex;
            align-items: center;
            height: 100%;

            &::before {
                content: "";
                position: absolute;
                left: 10px;
                right: 10px;
                height: 8px;
                border-radius: 4px;
                border: 1px solid $bg;
                background: $red;
                box-shadow: inset 0 0 3px rgba(black, 0.75),
                    0 0 10px rgba($red, 0.75);
                transition: $transition;
            }
        }
        input:checked {
            + .slider {
                &::before,
                &::after {
                    transform: translateX(calc(100% + 4px));
                }
                &::before {
                    border-left: 2px solid rgba($green, 0.5);
                    border-right: 2px solid transparent;
                }
            }
            ~ .light::before {
                background: $green;
                box-shadow: inset 0 0 3px rgba(black, 0.75),
                    0 0 10px rgba($green, 0.75);
            }
        }
    }

    // TOGGLE TWELVE //
    .toggle.twelve {
        &::before,
        &::after {
            position: absolute;
            transform: translateY(-50%);
            top: 50%;
            height: $width / 4;
            line-height: $width / 4;
            font-size: $font-size;
            font-weight: bold;
        }
        &::before {
            content: "ON";
            color: $green;
            left: -5px;
            width: calc(100% + 10px);
            background: darken($bg, 10);
            box-shadow: inset 0 0 5px rgba(black, 0.75);
            border-radius: 6px;
            border: 2px solid lighten($bg, 5);
            padding-left: 10px;
        }
        &::after {
            content: "OFF";
            color: $red;
            right: -5px;
            padding-right: 10px;
        }

        .slider {
            left: 0;
            top: 50%;
            height: 80%;
            background: lighten($bg, 10);
            border-radius: 6px;
            border: 4px solid $bg;
            box-shadow: 0 0 5px rgba(black, 0.5), 0 0 15px rgba(black, 0.25);
            transform: translateY(-50%);
            z-index: 1;

            &::before {
                position: absolute;
                top: 0;
                left: 0;
                font-weight: bold;
                text-align: center;
            }

            &::before {
                content: "|||";
                color: $bg;
                text-shadow: 1px 1px 1px lighten($bg, 20);
                line-height: $width / 2 - 8;
                width: 100%;
                z-index: 1;
            }
        }
        input:checked + .slider {
            transform: translate(calc(100% + 8px), -50%);
        }
    }

    // TOGGLE THIRTEN //
    .toggle.thirteen {
        &::before {
            content: "";
            position: absolute;
            top: -5px;
            left: -5px;
            width: calc(100% + 10px);
            height: calc(100% + 10px);
            background: linear-gradient(
                0deg,
                darken($bg, 10),
                lighten($bg, 10)
            );
            border-radius: $width / 2 0;
        }

        .slider {
            left: 0;
            width: 100%;
            background: darken($bg, 10);
            border-radius: $width / 2 0;
            box-shadow: inset 0 0 10px rgba(black, 0.75);
            background-image: radial-gradient(
                darken($bg, 4) 1px,
                transparent 1px
            );
            background-size: 6px 6px;

            &::before,
            &::after {
                content: "";
                position: absolute;
                border-radius: 100% 0 0;
                transition: $transition;
            }
            &::before {
                left: 2px;
                top: 2px;
                width: calc(50% - 4px);
                height: calc(100% - 4px);
                background: linear-gradient(
                    0deg,
                    darken($bg, 10),
                    lighten($bg, 10)
                );
            }
            &::after {
                left: 10px;
                top: 8px;
                width: calc(50% - 18px);
                height: calc(100% - 16px);
                background: $red;
                box-shadow: inset 0 0 5px rgba(black, 0.75);
                border: 1px solid lighten($bg, 10);
            }
        }
        input:checked + .slider {
            &::before,
            &::after {
                border-radius: 0 0 100%;
            }
            &::before {
                transform: translateX(calc(100% + 4px));
            }
            &::after {
                background: $green;
                transform: translateX(calc(100% + 16px));
            }
        }
    }

    // TOGGLE FORTEN //
    .toggle.fourteen {
        &::before {
            content: "";
            position: absolute;
            top: -4px;
            left: -4px;
            width: calc(100% + 8px);
            height: calc(100% + 8px);
            background: linear-gradient(
                180deg,
                lighten($bg, 10),
                darken($bg, 10)
            );
        }

        .slider {
            top: 4px;
            left: 4px;
            width: calc(100% - 8px);
            height: calc(100% - 8px);
            font-size: $font-size;
            text-align: center;
            color: lighten($bg, 5);
            text-shadow: 0 -2px 1px darken($bg, 20), 0 1px 1px lighten($bg, 10);
            z-index: 1;

            &::before,
            &::after {
                display: flex;
                align-items: center;
                justify-content: center;
                position: absolute;
                top: 0;
                width: 50%;
                height: 100%;
                border: 1px solid darken($bg, 20);
                background: darken($bg, 10);
                transition: $transition;
            }
            &::before {
                content: "OFF";
                left: 0;
                color: $red;
            }
            &::after {
                content: "ON";
                right: 0;
                box-shadow: 0 5px 5px rgba(black, 0.75);
                border-top: 2px solid $bg;
            }
        }
        .light {
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            border: 2px solid var(--border, tomato);
            box-shadow: 0 0 10px rgba($red, 0.5);
            background: linear-gradient(
                0deg,
                lighten($bg, 10),
                darken($bg, 10)
            );
            transition: $transition;
        }
        input:checked {
            + .slider {
                &::before {
                    box-shadow: 0 5px 5px rgba(black, 0.75);
                    border-top: 2px solid $bg;
                    color: inherit;
                }
                &::after {
                    border-top: 1px solid darken($bg, 20);
                    box-shadow: inherit;
                    color: $green;
                }
            }
            ~ .light {
                --border: limegreen;
                box-shadow: 0 0 10px rgba($green, 0.5);
            }
        }
    }

    // TOGGLE FIFTEEN //
    .toggle.fifteen {
        z-index: 1;

        &::before,
        &::after {
            content: "";
            position: absolute;
            border-radius: 50%;
        }
        &::before {
            top: 0;
            left: 0;
            height: 100%;
            width: 50%;
            background: linear-gradient(
                180deg,
                lighten($bg, 15),
                darken($bg, 15)
            );
        }
        &::after {
            top: 6px;
            left: 6px;
            height: calc(100% - 12px);
            width: calc(50% - 12px);
            background: linear-gradient(
                0deg,
                lighten($bg, 10),
                darken($bg, 15)
            );
            border-top: 2px solid lighten($bg, 20);
            border-bottom: 2px solid darken($bg, 15);
            box-shadow: 0 10px 5px rgba(black, 0.35);
        }

        .slider {
            top: 0;
            left: 0;
            width: 50%;
            height: 100%;

            transform: rotate(-15deg);
            z-index: -1;

            &::before,
            &::after {
                content: "";
                position: absolute;
                right: -12px;
                border-style: solid;
                z-index: -1;
            }
            &::before {
                bottom: 50%;
                border-width: 12px 0 0 15px;
                border-color: transparent transparent transparent
                    lighten($bg, 10);
            }
            &::after {
                top: 50%;
                border-width: 12px 15px 0 0;
                border-color: darken($bg, 15) transparent transparent
                    transparent;
            }
        }
        .light {
            position: absolute;
            right: 0;
            width: 50%;
            height: 100%;
            color: darken($bg, 5);

            &::before,
            &::after {
                position: absolute;
                width: 100%;
                font-size: $font-size;
                font-weight: bold;
                text-align: right;
                text-shadow: 0 -2px 1px darken($bg, 20),
                    0 1px 1px lighten($bg, 10);
                margin-left: 10px;
                transition: $transition;
            }
            &::before {
                content: "OFF";
                color: $red;
                top: 0;
            }
            &::after {
                content: "ON";
                bottom: 0;
            }
        }
        input:checked {
            + .slider {
                transform: rotate(15deg);
            }
            ~ .light {
                &::before {
                    color: inherit;
                }
                &::after {
                    color: $green;
                }
            }
        }
    }

    // TOGGLE SIXTEEN //
    @keyframes checked {
        0% {
            transform: scaleY(1) translateX(0);
        }
        50% {
            transform: scaleY(0.5) translateX(calc(50% + 12px));
        }
        100% {
            transform: scaleY(1) translateX(calc(100% + 12px));
        }
    }
    @keyframes unchecked {
        0% {
            transform: scaleY(1) translateX(calc(100% + 12px));
        }
        50% {
            transform: scaleY(0.5) translateX(calc(50% + 12px));
        }
        100% {
            transform: scaleY(1) translateX(0);
        }
    }
    .toggle.sixteen {
        display: flex;
        align-items: center;
        background: darken($bg, 10);
        border-radius: $width / 4;
        box-shadow: inset 0 0 0 2px lighten($bg, 10),
            inset 0 0 10px rgba(black, 0.75), 6px 0 3px -3px darken($bg, 10),
            -6px 0 3px -3px darken($bg, 10);
        overflow: hidden;

        &::before,
        &::after {
            position: absolute;
            width: 50%;
            font-size: $font-size;
            font-weight: bold;
            text-align: center;
        }
        &::before {
            content: "ON";
            color: $green;
            left: 2px;
        }
        &::after {
            content: "OFF";
            color: $red;
            right: 2px;
        }

        .slider {
            top: 6px;
            left: 6px;
            width: calc(50% - 12px);
            height: calc(100% - 12px);
            border-radius: 50%;
            border: 4px solid var(--border, tomato);
            background: darken($bg, 10);
            z-index: 1;
            box-shadow: 0 0 5px rgba(black, 0.5);
        }

        .light {
            &::before,
            &::after {
                content: "";
                left: 0;
                right: 0;
                position: absolute;
                width: 50%;
                height: 50%;
                margin: 0 auto;
                background: $bg;
                border-radius: 50%;
                z-index: 1;
            }
            &::before {
                top: -40%;
                box-shadow: 0 0 0 2px lighten($bg, 10),
                    0 5px 8px -4px rgba(black, 0.75);
            }
            &::after {
                bottom: -40%;
                box-shadow: 0 0 0 2px lighten($bg, 10),
                    0 -5px 8px -4px rgba(black, 0.75);
            }
        }

        input:not(:checked) + .slider {
            animation: unchecked 0.2s forwards;
        }

        input:checked + .slider {
            animation: checked 0.2s forwards;
            --border: limegreen;
        }
    }
}

              
            
!

JS

              
                
              
            
!
999px

Console