Newer
Older
JD / toggle.css
@Numakura Yuma Numakura Yuma on 25 Aug 2024 1016 bytes Update toggle.css
body {
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background-color: #f0f0f0;
}

.toggle-switch {
    position: relative;
    width: 60px;
    height: 30px;
    margin-bottom: 20px;
}

.toggle-switch input {
    display: none;
}

.switch {
    position: absolute;
    cursor: pointer;
    background-color: #ccc;
    border-radius: 15px;
    width: 100%;
    height: 100%;
    transition: background-color 0.3s;
}

.switch::before {
    content: '';
    position: absolute;
    background-color: #fff;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

input:checked + .switch {
    background-color: #4CAF50;
}

input:checked + .switch::before {
    transform: translateX(30px);
}

#image-container {
    display: none;
    text-align: center;
}

#image-container img {
    max-width: 300px;
    height: auto;
}