I added margin-top: 50pxto close the window and give space for the label. Here is the full CSS, I am not editing your original code, I have added a few lines. I wrote comments on the lines I added.
input[type="checkbox"]:not(:checked),
input[type="checkbox"]:checked {
position: absolute;
left: -9999px;
opacity: 0;
}
input[type="checkbox"]:not(:checked) + label,
input[type="checkbox"]:checked + label{
position: relative;
padding-left: 50px;
cursor: pointer;
text-align: center;
padding-left: 4px;
}
input[type="checkbox"]:not(:checked) + label:before,
input[type="checkbox"]:checked + label:before {
content: '';
position: absolute;
left:0; top: 2px;
width: 40px; height: 40px;
background: #f8f8f8;
border-radius: 3px;
border: 2px solid #aaa;
-webkit-box-shadow: groove 0 0 13px rgba(0, 0, 0, 0.5);
box-shadow: groove 0 0 13px rgba(0, 0, 0, 0.5);
margin-top: 20px;
}
input[type="checkbox"]:not(:checked) + label:after,
input[type="checkbox"]:checked + label:after {
content: '✔';
position: absolute;
top: 0; left: 5px;
font-size: 34px;
color: green;
transition: all .2s;
-webkit-transition: all .2s;
-moz-transition: all .2s;
-ms-transition: all .2s;
-o-transition: all .2s;
margin-top: 20px;
}
input[type="checkbox"]:not(:checked) + label:after {
opacity: 0;
transform: scale(0);
}
input[type="checkbox"]:checked + label:after {
opacity: 1;
transform: scale(1);
}
source
share