/*开关的大小*/
.switch-container {
    height: 15px;
    width: 60px;
}

/*设置checkbox不显示*/
.switch {
    display: none;
}

/*设置label标签为椭圆状*/
.switchLabel {
    display: block;
    background-color: #EEEEEE;
    height: 100%;
    width: 100%;
    cursor: pointer;
    border-radius: 25px;
}

/*在label标签内容之前添加如下样式，形成一个未选中状态*/
.switchLabel:before {
    content: '';
    display: block;
    border-radius: 25px;
    height: 100%;
    width: 15px;
    background-color: white;
    opacity: 1;
    box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.08);
    -webkit-transition: all 0.2s ease;
}

/*在label标签内容之后添加如下样式，形成一个选中状态*/
.switchLabel:after {
    position: relative;
    top: -15px;
    left: 45px;
    content: '';
    display: block;
    border-radius: 25px;
    height: 100%;
    width: 15px;
    background-color: white;
    opacity: 0;
    box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.08);
    -webkit-transition: all 0.2s ease;
}

/*选中后，选中样式显示*/
#switch:checked~label:after {
    opacity: 1;
}

/*选中后，未选中样式消失*/
#switch:checked~label:before {
    opacity: 0;
}

/*选中后label的背景色改变*/
#switch:checked~label {
    background-color: green;
}