Skip to content

Instantly share code, notes, and snippets.

@alenthomas
Created August 7, 2019 06:15
Show Gist options
  • Save alenthomas/7fc616bfd4d1d4402b2ffeb6ebd2446e to your computer and use it in GitHub Desktop.
Save alenthomas/7fc616bfd4d1d4402b2ffeb6ebd2446e to your computer and use it in GitHub Desktop.
Custom css styling for input type checkbox
input[type='checkbox'] {
outline: none !important;
padding: 0;
margin: 4px 0 0;
line-height: normal;
border: none;
-webkit-appearance: none;
appearance: none;
cursor: pointer;
}
input[type='checkbox']:after {
content: '';
display: block;
width: 15px;
height: 15px;
margin-top: -2px;
margin-right: 5px;
border: solid 1px #1da1f2;
border-radius: 2px;
-webkit-transition: 240ms;
-o-transition: 240ms;
transition: 240ms;
box-sizing: border-box;
}
input[type='checkbox']:checked:after {
content: '';
border-color: #1da1f2;
background-color: #1da1f2;
}
input[type='checkbox']:checked:before {
content: '';
position: absolute;
margin-top: 2px;
margin-left: 5px;
display: table;
width: 3px;
height: 6px;
border: 2px solid #fff;
border-top-width: 0;
border-left-width: 0;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment