<form>
<label class="toggle">
<div class="toggle__wrapper">
<input type="checkbox">
<div class="toggle__bg">
<div class="toggle__sphere">
<div class="toggle__sphere-bg">
</div>
<div class="toggle__sphere-overlay"></div>
</div>
</div>
</div>
</label>
</form>
* {
box-sizing: border-box;
}
html {
height: 100%;
}
body {
height: 100%;
background: linear-gradient(#ffad00 50%, #d58500);
background-repeat: no-repeat;
background-attachment: fixed;
display: flex;
justify-content: center;
align-items: center;
}
form {
width: 600px;
height: 350px;
margin: -4px -2px;
border-radius: 500px;
background: linear-gradient(#ffbd00, #ca7900);
box-shadow: 0 1px 5px hsla(41, 100%, 40%, 0.3),
-3px 25px 25px hsla(41, 100%, 35%, 0.5),
-6px 50px 50px hsla(41, 100%, 30%, 0.3),
-9px 65px 65px hsla(41, 100%, 20%, 0.3);
}
.toggle {
display: flex;
justify-content: center;
align-items: center;
width: 600px;
height: 350px;
background: #ffad00;
border-radius: 500px;
border: solid 5px transparent;
background-clip: padding-box;
cursor: pointer;
}
.toggle__wrapper {
width: 500px;
height: 250px;
margin: -4px -2px;
border-radius: 500px;
background: linear-gradient(hsla(39, 100%, 44%, 1), hsla(39, 100%, 42%, 0.1));
box-shadow: 0px 5px 1px 0 hsla(41, 100%, 57%, 0.7);
}
.toggle__bg {
width: 500px;
height: 250px;
background: hsla(199, 43%, 59%, 1);
background: linear-gradient(to right, hsla(199, 43%, 59%, 1) 50%, hsla(18, 77%, 50%, 1) 50% 100%);
background-size: 200% 100%;
background-position: 75%;
border-radius: 500px;
border: solid 5px transparent;
background-clip: padding-box;
box-shadow: inset 0px 30px 50px 15px hsla(0, 0%, 0%, 0.30);
transition: all 0.85s ease-in-out;
}
.toggle__sphere {
position: relative;
height: 238px;
width: 238px;
background: hsla(18, 100%, 62%, 1);
background:
linear-gradient(to right, hsla(199, 43%, 59%, 1) 50%, hsla(18, 77%, 50%, 1) 50% 100%);
border-radius: 50%;
transform-origin: top left;
transform: translateY(1px);
box-shadow:
2px 0px 5px 1px hsla(18, 77%, 15%, 0.05),
0px 10px 10px 1px hsla(18, 77%, 15%, 0.2),
-3px 0px 3px 1px hsla(0, 0%, 0%, 0.75);
transition: all 0.85s ease-in-out;
}
.toggle__sphere:before,
.toggle__sphere:after {
content: '';
position: absolute;
left: calc(50% - 20px);
height: 1px;
width: 40px;
background: hsla(0, 0%, 0%, 0.25);
border-radius: 50%;
box-shadow: 0px 0px 10px 0px hsla(0, 0%, 0%, 0.25);
}
.toggle__sphere:before {
top: -2px;
}
.toggle__sphere:after {
bottom: -1px;
}
.toggle__sphere-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: transparent;
border-radius: 50%;
box-shadow: inset 0px -30px 30px 15px hsla(0, 0%, 0%, 0.1)
}
.toggle__sphere-bg {
position: relative;
width: 100%;
height: 100%;
transform-style: preserve-3d;
border-radius: 50%;
transition: transform 0.85s ease-in-out;
}
.toggle__sphere-bg:before,
.toggle__sphere-bg:after {
content: '';
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
backface-visibility: hidden;
}
.toggle__sphere-bg:before {
background-color: hsla(18, 77%, 50%, 1);
border-radius: 50%;
}
.toggle__sphere-bg:after {
background-color: hsla(199, 43%, 59%, 1);
transform: rotateY(180deg);
border-radius: 50%;
}
input {
opacity: 0;
width: 0;
height: 0;
position: absolute;
}
input:checked + .toggle__bg {
background-position: 25%;
}
input:checked + .toggle__bg .toggle__sphere {
transform: translateX(250px) translateY(1px);
box-shadow:
-2px 0px 5px 1px hsla(18, 77%, 15%, 0.05),
0px 10px 10px 1px hsla(18, 77%, 15%, 0.2),
3px 0px 3px 0px hsla(0, 0%, 0%, 0.75);
}
input:checked + .toggle__bg .toggle__sphere-bg {
transform: rotateY(180deg);
}
.
[fallen . ;(--------:)]
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.