Created
January 31, 2018 18:47
-
-
Save cron64/7aeaa152d896844d39d1678a9ad15d6b to your computer and use it in GitHub Desktop.
CSS: Custom checkbox 2.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<label class="control control--checkbox">He leído y acepto los <a href="">Términos y condiciones</a> y el <a href="">Aviso de privacidad</a>. | |
<input type="checkbox"> | |
<div class="control__indicator"></div> | |
</label> | |
.control | |
font-size 18px | |
position relative | |
margin-bottom 15px | |
padding-left 30px | |
cursor pointer | |
.control input | |
position absolute | |
z-index -1 | |
opacity 0 | |
.control__indicator | |
position absolute | |
top 2px | |
left 0 | |
width 20px | |
height 20px | |
background white | |
border 1px solid #C5C5C5 | |
.control:hover input ~ .control__indicator | |
.control input:focus ~ .control__indicator | |
background white | |
.control input:checked ~ .control__indicator | |
background white | |
.control:hover input:not([disabled]):checked ~ .control__indicator | |
.control input:checked:focus ~ .control__indicator | |
background white | |
.control input:disabled ~ .control__indicator | |
pointer-events none | |
opacity .6 | |
background #e6e6e6 | |
.control__indicator:after | |
position absolute | |
display none | |
content '' | |
.control input:checked ~ .control__indicator:after | |
display block | |
.control--checkbox .control__indicator:after | |
top 4px | |
left 8px | |
width 3px | |
height 8px | |
transform rotate(45deg) | |
border solid #FF8000 | |
border-width 0 2px 2px 0 | |
.control--checkbox input:disabled ~ .control__indicator:after | |
border-color #7b7b7b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment