Material Radio and Checkbox
by Ayyappan Sakthivadivel
HTML
<link rel="stylesheet" href="http://bootswatch.com/paper/bootstrap.css">
<div class="radio">
<label>
<input type="radio" name="radio" value="option1" checked />
Radio 1
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="radio" value="option1" />
Radio 2
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="radio1" value="option1" disabled />
Disabled
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="radio1" value="option1" disabled checked />
Disabled and checked
</label>
</div>
CSS
body {
margin: 20px;
}
/* --- material checkbox and radio for bootswatch --- */
/* shared between both checkbox and radio */
.radio label, .checkbox label {
padding-left: 25px;
}
input[type="checkbox"] {
margin: 4px 0 0;
}
.radio input[type="radio"], .radio-inline input[type="radio"], .checkbox input[type="checkbox"], .checkbox-inline input[type="checkbox"] {
-webkit-appearance: none;
margin-left: -25px;
}
.radio input[type="radio"]:after, .radio-inline input[type="radio"]:after, .checkbox input[type="checkbox"]:after, .checkbox-inline input[type="checkbox"]:after {
border-color: rgba(0, 0, 0, 0.54);
}
.radio input[type="radio"]:disabled:after, .radio-inline input[type="radio"]:disabled:after, .checkbox input[type="checkbox"]:disabled:after, .checkbox-inline input[type="checkbox"]:disabled:after {
border-color: rgba(0, 0, 0, 0.26);
}
.radio input[type="radio"]:focus, .radio-inline input[type="radio"]:focus, .checkbox input[type="checkbox"]:focus, .checkbox-inline input[type="checkbox"]:focus {
outline: none;
}
/* checkbox */
input[type="radio"] {
margin: 3px 0 0;
}
.checkbox input[type="checkbox"]:after, .checkbox-inline input[type="checkbox"]:after {
border: 2px solid;
border-radius: 2px;
content: '';
display: block;
height: 18px;
transition: 240ms;
width: 18px;
}
.checkbox input[type="checkbox"]:checked:before, .checkbox-inline input[type="checkbox"]:checked:before {
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
position: absolute;
left: 6px;
top: 0;
display: table;
width: 6px;
height: 12px;
border: 2px solid #fff;
border-top: 0;
border-left: 0;
content: '';
}
.checkbox input[type="checkbox"]:checked:after, .checkbox-inline input[type="checkbox"]:checked:after {
background-color: #0c84e4;
border-color: #0c84e4;
}
.checkbox input[type="checkbox"]:disabled:checked:after, .checkbox-inline...