<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
</head>
<body>
<style>
html, body {
height: 100%;
}
body {
background: linear-gradient(#f7f7f7, #e0e0e0);
margin: 0;
}
.wrap {
position: relative;
width: 33.33%;
margin: -72px 0;
top: 50%;
float: left;
}
[class*="slider-"] {
display: none;
}
label {
margin: 1.5em auto;
}
.slider-v1 + label {
position: relative;
display: block;
width: 5.5em;
height: 3em;
cursor: pointer;
border-radius: 1.5em;
background: linear-gradient(rgba(0, 0, 0, 0.07), rgba(255, 255, 255, 0)), #ddd;
box-shadow: 0 0.07em 0.1em -0.1em rgba(0, 0, 0, 0.4) inset,
0 0.05em 0.08em -0.01em rgba(255, 255, 255, 0.7);
}
.slider-v1 + label::before {
position: absolute;
content: '';
width: 2em;
height: 2em;
top: 0.5em;
left: 0.5em;
border-radius: 50%;
transition: 250ms ease-in-out;
background: linear-gradient(#f5f5f5 10%, #eeeeee);
box-shadow: 0 0.1em 0.15em -0.05em rgba(255, 255, 255, 0.9) inset,
0 0.5em 0.3em -0.1em rgba(0, 0, 0, 0.25);
}
.slider-v1 + label::after {
position: absolute;
content: '';
width: 1em;
height: 1em;
top: 1em;
left: 6em;
border-radius: 50%;
transition: 250ms ease-in;
background: linear-gradient(rgba(0, 0, 0, 0.07), rgba(255, 255, 255, 0.1)), #ddd;
box-shadow: 0 0.08em 0.15em -0.1em rgba(0, 0, 0, 0.5) inset,
0 0.05em 0.08em -0.01em rgba(255, 255, 255, 0.7), -7.25em 0 0 -0.25em rgba(0, 0, 0, 0.3);
}
.slider-v1:checked + label::after {
background: linear-gradient(rgba(0, 0, 0, 0.07), rgba(255, 255, 255, 0.1)), #4c6;
box-shadow: 0 0.08em 0.15em -0.1em rgba(0, 0, 0, 0.5) inset,
0 0.05em 0.08em -0.01em rgba(255, 255, 255, 0.7), -7.25em 0 0 -0.25em rgba(0, 0, 0, 0.12);
}
.slider-v1:checked + label::before {
left: 3em;
}
.slider-v2 + label {
position: relative;
display: block;
width: 5.5em;
height: 3em;
cursor: pointer;
border-radius: 1.5em;
background: linear-gradient(rgba(0, 0, 0, 0.07), rgba(255, 255, 255, 0)), #ddd;
box-shadow: 0 0.07em 0.1em -0.1em rgba(0, 0, 0, 0.4) inset,
0 0.05em 0.08em -0.01em rgba(255, 255, 255, 0.7);
}
.slider-v2 + label::after {
position: absolute;
content: '';
width: 2em;
height: 2em;
top: 0.5em;
left: 0.5em;
border-radius: 50%;
transition: 250ms ease-in-out;
background: linear-gradient(#f5f5f5 10%, #eeeeee);
box-shadow: 0 0.1em 0.15em -0.05em rgba(255, 255, 255, 0.9) inset,
0 0.2em 0.2em -0.12em rgba(0, 0, 0, 0.5);
}
.slider-v2 + label::before {
position: absolute;
content: '';
width: 4em;
height: 1.5em;
top: 0.75em;
left: 0.75em;
border-radius: 0.75em;
transition: 250ms ease-in-out;
background: linear-gradient(rgba(0, 0, 0, 0.07), rgba(255, 255, 255, 0.1)), #d0d0d0;
box-shadow: 0 0.08em 0.15em -0.1em rgba(0, 0, 0, 0.5) inset,
0 0.05em 0.08em -0.01em rgba(255, 255, 255, 0.7), 0 0 0 0 rgba(68, 204, 102, 0.7) inset;
}
.slider-v2:checked + label::before {
box-shadow: 0 0.08em 0.15em -0.1em rgba(0, 0, 0, 0.5) inset,
0 0.05em 0.08em -0.01em rgba(255, 255, 255, 0.7), 3em 0 0 0 rgba(68, 204, 102, 0.7) inset;
}
.slider-v2:checked + label::after {
left: 3em;
}
.slider-v3 + label {
position: relative;
display: block;
width: 7em;
height: 3em;
cursor: pointer;
border-radius: 1.5em;
background: #d9d9d9;
}
.slider-v3 + label::after {
position: absolute;
content: '';
width: 2em;
height: 2em;
top: 0.5em;
left: 0.5em;
border-radius: 1.5em;
transition: width 200ms ease-out, height 300ms 50ms ease-in, top 300ms 50ms ease-in,
left 250ms 50ms ease-in, box-shadow 300ms ease-in;
background: #4c6;
box-shadow: 0 0 0 1.5em #f2f2f2 inset;
}
.slider-v3:checked + label::after {
width: 4em;
height: 3em;
top: 0;
left: 3em;
box-shadow: 0 0 0 0 #f2f2f2 inset;
}
</style>
<div>
<input type="checkbox" id="s1" />
<label for="s1"></label>
<input type="checkbox" id="s2" checked="" />
<label for="s2"></label>
</div>
<div>
<input type="checkbox" id="s3" />
<label for="s3"></label>
<input type="checkbox" id="s4" checked="" />
<label for="s4"></label>
</div>
<div>
<input type="checkbox" id="s5" />
<label for="s5"></label>
<input type="checkbox" id="s6" checked="" />
<label for="s6"></label>
</div>
</body>
</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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|