-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
78 lines (68 loc) · 1.37 KB
/
index.html
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!-- Здесь описываем дизайн пользовательского интерфейса -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
margin: 0;
padding: 0;
width: 300px;
height: 300px;
background: linear-gradient(149deg, rgba(24,187,156,1) 0%, rgba(106,57,175,1) 42%, rgba(187,24,148,1) 72%, rgba(115,53,134,1) 100%);
animation: gradient 10s infinite linear;
background-size: 400%;
}
input[type=checkbox]{
height: 0;
width: 0;
visibility: hidden;
}
label {
cursor: pointer;
text-indent: -9999px;
width: 100px;
height: 50px;
background: grey;
display: block;
border-radius: 50px;
position: relative;
}
label:after {
content: '';
position: absolute;
top: 2.5px;
left: 2.5px;
width: 45px;
height: 45px;
background: #fff;
border-radius: 45px;
transition: 0.3s;
}
input:checked + label {
background: #66ff99;
}
input:checked + label:after {
left: calc(100% - 2.5px);
transform: translateX(-100%);
}
label:active:after {
width: 65px;
}
@keyframes gradient {
0% {
background-position: 80% 0%;
}
50% {
background-position: 20% 100%;
}
100% {
background-position: 80% 0%;
}
}</style>
</head>
<body >
<input type="checkbox" id="switch" /><label for="switch">Toggle</label>
<script src="colorBg.js"></script>
</body>
</html>