body {
    font-family: Arial, sans-serif;
}

label.ampm-switch {
    z-index: 1;
    position: relative;
    box-sizing: border-box;
    display: inline-block;
    vertical-align: middle;
    border-radius: 3px;
    overflow: hidden;
    width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
    background-color: black;
}
label.ampm-switch:before,
label.ampm-switch:after {
    box-sizing: border-box;
    display: block;
    width: 20px;
    height: 10px;
    font-size:7px;
    /* font-weight: bold; */
    text-align: center;
    line-height: 10px;
    color: white;
}
label.ampm-switch:before {
    content: "AM";
}

label.ampm-switch:after {
    content: "PM";
}

label.ampm-switch input {
    position: absolute;
    overflow: hidden;
    clip: rect(0 0 0 0);
    margin: 0;
    padding: 0;
    border: 0;
    -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0.1);
    filter: alpha(opacity=0.1);
    opacity: .001;
}


label.ampm-switch .toggle-button {
    z-index: 2;
    display: inline-block;  
    position: absolute;
    top:0;
    padding: 0;
    margin: 0;
    width: 20px;
    height: 10px;
    background: transparent;
    box-sizing: border-box;
    background-clip: padding-box;
    white-space: nowrap;
    border: 1px solid black;
    color: red;
    background-color: white;
    -webkit-transition: top .05s ease-in-out;
    -moz-transition: top .05s ease-in-out;
    -o-transition: top .05s ease-in-out;
    -ms-transition: top .05s ease-in-out;
    transition: top .05s ease-in-out;

}

label.ampm-switch input:checked + .toggle-button {
    top: 10px;
}

label.ampm-switch .toggle-button:before {
    box-sizing: border-box;
    display: block;
    width: 20px;
    height: 10px;
    font-size: 6px;
    /* font-weight: bold; */
    text-align: center;
    line-height: 10px;
    color: black;
}
label.ampm-switch .toggle-button:before {
    content: "AM";
}


label.ampm-switch input:checked + .toggle-button:before {
    content: "PM";
}