Skip to content

Instantly share code, notes, and snippets.

@cron64
Last active June 25, 2018 18:29
Show Gist options
  • Save cron64/b45e56be9ac33650d82f41e46171a85d to your computer and use it in GitHub Desktop.
Save cron64/b45e56be9ac33650d82f41e46171a85d to your computer and use it in GitHub Desktop.
CSS: Custom Radio 2.0
.control_radio
position relative
padding-left 30px
cursor pointer
font-size 14px
input
position absolute
z-index -1
opacity 0
.control--radio__indicator
position absolute
top 2px
left 0
height 18px
width 18px
border 1px solid rgba(#9B9B9B,.4)
.control--radio &
border-radius 50%
.control_radio:hover input ~ &,
.control_radio input:focus ~ &
background rgba(#9B9B9B,.2)
.control_radio input:checked ~ &
background white
.control_radio:hover input:not([disabled]):checked ~ &,
.control_radio input:checked:focus ~ &
background white
.control_radio input:disabled ~ &
background grey
opacity 0.6
pointer-events none
&:after
content ''
position absolute
display none
.control_radio input:checked ~ &
display block
.control--radio &
left 2px
top 2px
height 12px
width 12px
border-radius 50%
background #B8E986
.control--radio input:disabled ~ &
background grey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment