Skip to content

Instantly share code, notes, and snippets.

@RafaPegorari
Created September 1, 2015 17:14
Show Gist options
  • Save RafaPegorari/5d3926c06b7d5e148bff to your computer and use it in GitHub Desktop.
Save RafaPegorari/5d3926c06b7d5e148bff to your computer and use it in GitHub Desktop.
Checkbox And Radiobox CSS
/* ====== Checkbox And Radiobox ====== */
/*
<div class="md-checkbox">
<input type="checkbox" id="checkbox30" class="md-check">
<label for="checkbox30">
<span></span>
<span class="check"></span>
<span class="box"></span>
Option 1
</label>
</div>
<div class="md-radio">
<input type="radio" id="radio1" name="radio1" class="md-radiobtn">
<label for="radio1">
<span class="inc"></span>
<span class="check"></span>
<span class="box"></span>
Option 1
</label>
</div>
*/
.md-checkbox, .md-radio {
position: relative;
}
.md-checkbox input[type=checkbox], .md-radio input[type=radio] {
visibility: hidden;
position: absolute;
}
input[type=checkbox], input[type=radio] {
margin: 4px 0 0;
margin-top: 1px \9;
line-height: normal;
}
input[type=checkbox], input[type=radio] {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 0;
-webkit-border-radius: 0 !important;
-moz-border-radius: 0 !important;
border-radius: 0 !important;
}
.md-checkbox label, .md-radio label {
font-weight: 400;
font-size: 14px;
cursor: pointer;
padding-left: 30px;
}
.md-checkbox label > span, .md-radio label > span {
display: block;
position: absolute;
left: 0;
-webkit-transition-duration: 0.3s;
-moz-transition-duration: 0.3s;
transition-duration: 0.3s;
}
.md-checkbox label > span.inc, .md-radio label > span.inc {
background: #fff;
left: -20px;
top: -20px;
height: 60px;
width: 60px;
opacity: 0;
border-radius: 50% !important;
-moz-border-radius: 50% !important;
-webkit-border-radius: 50% !important;
}
.md-checkbox label > span.inc, .md-radio label > span.inc {
-webkit-animation: growCircle 0.3s ease;
-moz-animation: growCircle 0.3s ease;
animation: growCircle 0.3s ease;
}
.md-checkbox label > .check {
top: -4px;
left: 6px;
width: 10px;
height: 20px;
border: 2px solid #FF6C60;
border-top: none;
border-left: none;
opacity: 0;
z-index: 5;
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
transform: rotate(180deg);
-webkit-transition-delay: 0.3s;
-moz-transition-delay: 0.3s;
transition-delay: 0.3s;
}
.md-checkbox input[type=checkbox]:checked ~ label > .check {
opacity: 1;
-webkit-transform: scale(1) rotate(45deg);
-moz-transform: scale(1) rotate(45deg);
transform: scale(1) rotate(45deg);
}
.md-checkbox label > .box {
top: 0px;
border: 2px solid #666;
height: 20px;
width: 20px;
z-index: 5;
-webkit-transition-delay: 0.2s;
-moz-transition-delay: 0.2s;
transition-delay: 0.2s;
}
.md-checkbox input[type=checkbox]:checked ~ label > .box {
opacity: 0;
-webkit-transform: scale(0) rotate(-180deg);
-moz-transform: scale(0) rotate(-180deg);
transform: scale(0) rotate(-180deg);
}
.md-radio label > .check {
top: 5px;
left: 5px;
width: 10px;
height: 10px;
background: #FF6C60;
opacity: 0;
z-index: 6;
border-radius: 50% !important;
-moz-border-radius: 50% !important;
-webkit-border-radius: 50% !important;
-webkit-transform: scale(0);
-moz-transform: scale(0);
transform: scale(0);
}
.md-radio input[type=radio]:checked ~ label > .check {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
transform: scale(1);
}
.md-radio label > .box {
top: 0px;
border: 2px solid #666;
height: 20px;
width: 20px;
border-radius: 50% !important;
-moz-border-radius: 50% !important;
-webkit-border-radius: 50% !important;
z-index: 5;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment