"Custom radio/checkbox button / Funkyradio"
Bootstrap 4.1.1 Snippet by insiteout

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<div class="row">
<div class="col-auto mx-auto">
Custom radio and checkbox buttons.<br>
<strong>3</strong> sizes (SM, MD, LG) | <strong>25</strong> color styles
</div>
</div>
<div class="row">
<div class="col-12">
<div class="row">
<div class="col-12">
<h4>Radios with slight label's background</h4>
</div>
<div class="col-4">
<div class="funkyradio-default">
<div class="funkyradio-sm">
<input type="radio" name="radio-sm" id="radio-sm-0" value="1">
<label for="radio-sm-0">Radio SM default</label>
</div>
</div>
<div class="funkyradio-primary">
<div class="funkyradio-sm">
<input type="radio" name="radio-sm" id="radio-sm-1" value="1">
<label for="radio-sm-1">Radio SM primary</label>
</div>
</div>
<div class="funkyradio-secondary">
<div class="funkyradio-sm">
<input type="radio" name="radio-sm" id="radio-sm-2" value="1">
<label for="radio-sm-2">Radio SM secondary</label>
</div>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* FUNKY SM */
.funkyradio-sm label:not(.simple) {
/*min-width: 400px;*/
width: 100%;
border-radius: 3px;
border: 1px solid #D1D3D4;
font-weight: normal;
}
.funkyradio-sm input[type="radio"]:empty, .funkyradio-sm input[type="checkbox"]:empty {
display: none;
}
.funkyradio-sm input[type="radio"]:empty ~ label, .funkyradio-sm input[type="checkbox"]:empty ~ label {
position: relative;
line-height: 1.5em;
text-indent: 1.75em;
margin-top: 0.1em;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
font-size: 0.8rem;
}
.funkyradio-sm input[type="radio"]:empty ~ label:before, .funkyradio-sm input[type="checkbox"]:empty ~ label:before {
position: absolute;
display: block;
top: 0;
bottom: 0;
left: 0;
content:' ';
width: 2em;
font-size: 0.6rem;
background: #D1D3D4;
border-radius: 3px 0 0 3px;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: