Skip to content

Instantly share code, notes, and snippets.

@rleaf
Created December 13, 2018 19:41
Show Gist options
  • Select an option

  • Save rleaf/7accd2bccdb8a8e40e0f5151e93a6b18 to your computer and use it in GitHub Desktop.

Select an option

Save rleaf/7accd2bccdb8a8e40e0f5151e93a6b18 to your computer and use it in GitHub Desktop.
Custom Round Checkbox
<div class="container">
<div class="round">
<input type="checkbox" id="checkbox" />
<label for="checkbox"></label>
</div>
</div>
.round {
position: relative;
}
.round label {
background-color: #fff;
border: 1px solid #ccc;
border-radius: 50%;
cursor: pointer;
height: 28px;
left: 0;
position: absolute;
top: 0;
width: 28px;
}
.round label:after {
border: 2px solid #fff;
border-top: none;
border-right: none;
content: "";
height: 6px;
left: 7px;
opacity: 0;
position: absolute;
top: 8px;
transform: rotate(-45deg);
width: 12px;
}
.round input[type="checkbox"] {
visibility: hidden;
}
.round input[type="checkbox"]:checked + label {
background-color: #66bb6a;
border-color: #66bb6a;
}
.round input[type="checkbox"]:checked + label:after {
opacity: 1;
}
body {
background-color: #f1f2f3;
}
<link href="https://gitcdn.xyz/repo/AllThingsSmitty/e42d5dbd4f548b2a4ddbf442627a897f/raw/d2038e644ba35c5ec588057465c36435926ff7d9/flexbox-center-container.css" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment