Skip to content

Instantly share code, notes, and snippets.

@ryantbrown
Last active August 14, 2018 10:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ryantbrown/d23df28d2af0703d40d1c75e007d6754 to your computer and use it in GitHub Desktop.
Save ryantbrown/d23df28d2af0703d40d1c75e007d6754 to your computer and use it in GitHub Desktop.
SVG based checkbox
.checkbox {
height: 40px;
width: 40px;
outline: none;
cursor: default;
border: 0;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.checkbox:after {
content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="-10 -18 100 135"><circle cx="50" cy="50" r="50" fill="none" stroke="#ededed" stroke-width="5"/></svg>')
}
.checkbox:checked:after {
content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="-10 -18 100 135"><circle cx="50" cy="50" r="50" fill="none" stroke="#bddad5" stroke-width="5"/><path fill="#5dc2af" d="M72 25L42 71 27 56l-4 4 20 20 34-52z"/></svg>')
}
@ryantbrown
Copy link
Author

<input type="checkbox" class="checkbox">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment