Material Label Based Checkbox
by Faisal Pathan
HTML
<h3>
Material Label Based Checks
</h3>
<div class="label-check">
<div class="checkbox">
<input type="checkbox" name="checkGrp1" id="check1_Opt1">
<label for="check1_Opt1">A Label Here 1</label>
</div>
<div class="checkbox">
<input type="checkbox" name="checkGrp1" id="check1_Opt2" checked>
<label for="check1_Opt2">A Label Here 2</label>
</div>
</div>
<div class="label-check">
<div class="radio">
<input type="radio" name="radioGrp1" id="radio1_Opt1">
<label for="radio1_Opt1">Radio Label 1</label>
</div>
<div class="radio">
<input type="radio" name="radioGrp1" id="radio1_Opt2" checked>
<label for="radio1_Opt2">Radio Label 2</label>
</div>
</div>
<h3>Normies</h3>
<div>
<div>
<input type="checkbox" name="checkGrp2" id="check2_Opt1">
<label for="check2_Opt1">A Label Here 1</label>
</div>
<div>
<input type="checkbox" name="checkGrp2" id="check2_Opt2" checked>
<label for="check2_Opt2">A Label Here 2</label>
</div>
</div>
<div>
<div>
<input type="radio" name="radioGrp2" id="radio2_Opt1">
<label for="radio2_Opt1">Radio Label 1</label>
</div>
<div>
<input type="radio" name="radioGrp2" id="radio2_Opt2" checked>
<label for="radio2_Opt2">Radio Label 2</label>
</div>
</div>
<div style='position:fixed;bottom:0;left:0; background:lightgray;width:100%;'>
About this SO Question:
<a href='https://stackoverflow.com/a/48836931/1366033'>
Bootstrap Paper's material style of radio/checkbox inputs broken in IE/FF
</a>
</div>
CSS
body {
padding: 0 25px;
font-size: 1.2em;
}
.checkbox, .radio {
margin: 10px;
}
.checkbox, .radio {
position: relative;
}
.label-check label {
padding-left: 20px;
}
.label-check input[type="radio"],
.label-check input[type="checkbox"] {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
opacity: 0;
position: absolute;
margin: 0;
z-index: -1;
width: 0;
height: 0;
overflow: hidden;
left: 0;
pointer-events: none;
}
.label-check input[type="radio"]:focus {
outline: none;
}
.label-check input[type="radio"] + label:before,
.label-check input[type="radio"] + label:after {
content: "";
display: block;
position: absolute;
left: -10px;
top: 1px;
width: 18px;
height: 18px;
border-radius: 50%;
-webkit-transition: 240ms;
-o-transition: 240ms;
transition: 240ms;
}
.label-check input[type="radio"] + label:before {
left: -8px;
top: 3px;
}
.label-check input[type="radio"] + label:before {
background-color: #2196f3;
-webkit-transform: scale(0);
-ms-transform: scale(0);
-o-transform: scale(0);
transform: scale(0);
}
.label-check input[type="radio"] + label:after{
top: 1px;
border: 2px solid #666666;
z-index:1;
}
.label-check input[type="radio"]:checked + label:before {
-webkit-transform: scale(0.6);
-ms-transform: scale(0.6);
-o-transform: scale(0.6);
transform: scale(0.6);
}
.label-check input[type="radio"]:disabled:checked + label:before {
background-color: #bbbbbb;
}
.label-check input[type="radio"]:checked + label:after {
border-color: #2196f3;
}
.label-check input[type="radio"]:disabled + label:after,
.label-check input[type="radio"]:disabled:checked + label:after {
border-color: #bbbbbb;
}
.label-check input[type="checkbox"]:focus {
outline: none;
}
.label-check input[type="checkbox"]:focus + label:after{
border-color: #2196f3;
}
.label-check input[type="checkbox"] + label:after {
content:...