html - Custom CSS Checkbox with caption inside -


i'm trying create custom css checkboxes following designer's specs. checkboxes have circle 60px radius, , checkbox label must places @ center of circle. moreover, when checkbox "checked" background must becomes red.

here achieve create far : http://codepen.io/anon/pen/qdrqbv

here code :

html

<div class="mybox">   <input type="checkbox" value="none" id="sth" name="check" checked />   <label for="sth">     <span>       test     </span>   </label> </div> 

css

.mybox {   width: 120px;   position: relative;   margin: 0;   padding:0;   label {     color: #000;     width: 120px;     height: 120px;     padding:0;     cursor: pointer;     position: absolute;     top: 0;     left: 0;     text-align: center;     line-height: 120px;     border-radius: 50%;    border: 2px solid black;     &:after {       box-sizing: border-box;        content: '';       width: 120px;       height: 120px;       position: absolute;       top: 0px;       left: 0px;       border: 2px solid red;       background: red;       opacity: 0;       border-radius: 50%     }     }   input[type=checkbox] {     visibility: hidden;     &:checked + label:after {       opacity: 1;     }       } } 

the result quite meeting expectations can see on demo caption becomes hidden red overlay , i'm stuck fixing it.

any idea ? thank !

simplest way - add z-index: -1 after-element


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -