Skip to content

Instantly share code, notes, and snippets.

@lenards
Forked from gladchinda/checkbox.css
Created March 20, 2019 18:23
Show Gist options
  • Save lenards/59cea8f4d40679184662d6d7ea4503d0 to your computer and use it in GitHub Desktop.
Save lenards/59cea8f4d40679184662d6d7ea4503d0 to your computer and use it in GitHub Desktop.
/* Styles for hiding the native checkbox */
input[type='checkbox'].check-custom {
top: 0;
left: 0;
width: 0;
height: 0;
opacity: 0;
filter: alpha(opacity=0);
position: absolute;
visibility: hidden;
}
/* Styles for the basic appearance of the custom checkbox */
input[type='checkbox'].check-custom ~ .check-toggle {
width: 1rem;
height: 1rem;
position: relative;
display: inline-block;
vertical-align: middle;
border: 2px solid #969696;
border-radius: 50%;
cursor: pointer;
}
/* Styles for the hover state appearance of the custom checkbox */
input[type='checkbox'].check-custom:hover ~ .check-toggle {
border-color: #4a4a4a;
}
/* Styles for the checked state appearance of the custom checkbox */
input[type='checkbox'].check-custom:checked ~ .check-toggle {
border-color: #1785ff;
background: #1785ff url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmZmZmYiIHN0cm9rZS13aWR0aD0iMyIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48cG9seWxpbmUgcG9pbnRzPSIyMCA2IDkgMTcgNCAxMiI+PC9wb2x5bGluZT48L3N2Zz4=) center no-repeat;
background-size: 75%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment