"Custom Checkbox"
Bootstrap 4.0.0 Snippet by codename0

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
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/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="bg">
<div>
<div class="chiller_cb">
<input id="myCheckbox" type="checkbox" checked>
<label for="myCheckbox">Checkbox checked</label>
<span></span>
</div>
<div class="chiller_cb">
<input id="myCheckbox2" type="checkbox">
<label for="myCheckbox2">Checkbox unchecked</label>
<span></span>
</div>
<div class="chiller_cb">
<input id="myCheckbox3" type="checkbox" disabled>
<label for="myCheckbox3">Checkbox disabled</label>
<span></span>
</div>
</div>
</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
body {
height: 100vh;
padding: 0;
margin: 0;
}
.bg {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.span_pseudo, .chiller_cb span:before, .chiller_cb span:after {
content: "";
display: inline-block;
background: #fff;
width: 0;
height: 0.2rem;
position: absolute;
transform-origin: 0% 0%;
}
.chiller_cb {
position: relative;
height: 2rem;
display: flex;
align-items: center;
}
.chiller_cb input {
display: none;
}
.chiller_cb input:checked ~ span {
background: #fd2727;
border-color: #fd2727;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments:

how to swap places input and label

BlitZ288 () - 3 years ago - Reply 0


how to swap places input and label

BlitZ288 () - 3 years ago - Reply 0


how to swap places input and label

BlitZ288 () - 3 years ago - Reply 0