Skip to content

Instantly share code, notes, and snippets.

@xto3na
Forked from Raminsiach/css3checkbox.html
Created January 11, 2016 09:05
Show Gist options
  • Save xto3na/61813f8cdc1bc9a82d80 to your computer and use it in GitHub Desktop.
Save xto3na/61813f8cdc1bc9a82d80 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