Skip to content

Instantly share code, notes, and snippets.

@Raminsiach
Created December 18, 2015 10:42
Show Gist options
  • Save Raminsiach/69011f1f751fb0c43f66 to your computer and use it in GitHub Desktop.
Save Raminsiach/69011f1f751fb0c43f66 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<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;
}
</style>
</head>
<body>
<div class="checkbox">
<input type="checkbox" id="checkbox1">
<label for="checkbox1"></label>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment