Talk is cheap

css file named switcher

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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
html,
body {
margin: 0;
height: 100vh; }

body {
background-color: #ececec;
display: grid;
justify-items: center;
align-items: center; }

.switch {
position: relative;
display: block;
width: 90px;
height: 55px;
margin-bottom: 30px; }

.slider {
position: absolute;
cursor: pointer;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: #fff;
transition: .5s;
border: 3px solid #fff;
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1); }

.slider:before {
position: absolute;
content: '';
bottom: 14px;
top: 8px;
background-color: #afafaf;
transition: .5s; }

.switch input {
display: none; }

input:checked + .slider {
background-color: black; }

input:checked + .slider:before {
transform: translateX(47px) rotateZ(45deg);
background-color: yellow; }

.slider.round {
border-radius: 35px; }

.slider.round:before {
height: 43%;
width: 43%;
border-top-left-radius: 50px;
border-top-right-radius: 50px;
transform: rotateZ(-45deg); }
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
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>switcher</title>
<meta name='viewport' content='width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no'
/>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="css/switcher.css" rel="stylesheet">
</head>

<body>
<div>
<label for="switcher" class="switch">
<input id='switcher' type="checkbox">
<span class="slider round"></span>
</label>
<label for="other_switcher" class="switch">
<input id='other_switcher' type="checkbox">
<span class="slider round"></span>
</label>
</div>
</body>

</html>