Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<!DOCTYPE html>
<title>CSS3 Checkbox</title>
<style type="text/css">
.checkbox {
width: 30px;
height: 30px;
background-color: #ddd;
position: relative;
.checkbox input[type="checkbox"] {
visibility: hidden;
.checkbox label {
width: 28px;
height: 28px;
position: absolute;
top: 1px;
left: 1px;
background-color: white;
cursor: pointer;
.checkbox label:before {
content: '';
width: 9px;
height: 5px;
border: 3px solid white;
position: absolute;
border-top: none;
border-right: none;
transform: rotate(-45deg);
top: 8px;
left: 8px;
opacity: 0;
.checkbox input[type="checkbox"]:checked + label:before {
opacity: 1;
.checkbox input[type="checkbox"]:checked + label {
background-color: #57bba7;
<div class="checkbox">
<input type="checkbox" id="checkbox1">
<label for="checkbox1"></label>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.