Html :-
<button data-text="Awesome" class="button">
<span class="actual-text"> Dev_html </span>
<span class="hover-text" aria-hidden="true"> Dev_html </span>
</button>
<button data-text="Awesome" class="button">
<span class="actual-text"> Dev_html </span>
<span class="hover-text" aria-hidden="true"> Dev_html </span>
</button>
Css :-
/* === removing default button style ===*/
.button {
margin: 0;
height: auto;
background: transparent;
padding: 0;
border: none;
}
/* button styling */
.button {
--border-right: 6px;
--text-stroke-color: rgba(255,255,255,0.6);
--animation-color: #37FF8B;
--fs-size: 2em;
letter-spacing: 3px;
text-decoration: none;
font-size: var(--fs-size);
font-family: "Arial";
position: relative;
text-transform: uppercase;
color: transparent;
-webkit-text-stroke: 1px var(--text-stroke-color);
}
/* this is the text, when you hover on button */
.hover-text {
position: absolute;
box-sizing: border-box;
content: attr(data-text);
color: var(--animation-color);
width: 0%;
inset: 0;
border-right: var(--border-right) solid var(--animation-color);
overflow: hidden;
transition: 0.5s;
-webkit-text-stroke: 1px var(--animation-color);
}
/* hover */
.button:hover .hover-text {
width: 100%;
filter: drop-shadow(0 0 23px var(--animation-color))
}
/* === removing default button style ===*/
.button {
margin: 0;
height: auto;
background: transparent;
padding: 0;
border: none;
}
/* button styling */
.button {
--border-right: 6px;
--text-stroke-color: rgba(255,255,255,0.6);
--animation-color: #37FF8B;
--fs-size: 2em;
letter-spacing: 3px;
text-decoration: none;
font-size: var(--fs-size);
font-family: "Arial";
position: relative;
text-transform: uppercase;
color: transparent;
-webkit-text-stroke: 1px var(--text-stroke-color);
}
/* this is the text, when you hover on button */
.hover-text {
position: absolute;
box-sizing: border-box;
content: attr(data-text);
color: var(--animation-color);
width: 0%;
inset: 0;
border-right: var(--border-right) solid var(--animation-color);
overflow: hidden;
transition: 0.5s;
-webkit-text-stroke: 1px var(--animation-color);
}
/* hover */
.button:hover .hover-text {
width: 100%;
filter: drop-shadow(0 0 23px var(--animation-color))
}
Css:-
.loader {
position: relative;
width: 2.5em;
height: 2.5em;
transform: rotate(165deg);
}
.loader:before, .loader:after {
content: "";
position: absolute;
top: 50%;
left: 50%;
display: block;
width: 0.5em;
height: 0.5em;
border-radius: 0.25em;
transform: translate(-50%, -50%);
}
.loader:before {
animation: before8 2s infinite;
}
.loader:after {
animation: after6 2s infinite;
}
@keyframes before8 {
0% {
width: 0.5em;
box-shadow: 1em -0.5em rgba(225, 20, 98, 0.75), -1em 0.5em rgba(111, 202, 220, 0.75);
}
35% {
width: 2.5em;
box-shadow: 0 -0.5em rgba(225, 20, 98, 0.75), 0 0.5em rgba(111, 202, 220, 0.75);
}
70% {
width: 0.5em;
box-shadow: -1em -0.5em rgba(225, 20, 98, 0.75), 1em 0.5em rgba(111, 202, 220, 0.75);
}
100% {
box-shadow: 1em -0.5em rgba(225, 20, 98, 0.75), -1em 0.5em rgba(111, 202, 220, 0.75);
}
}
@keyframes after6 {
0% {
height: 0.5em;
box-shadow: 0.5em 1em rgba(61, 184, 143, 0.75), -0.5em -1em rgba(233, 169, 32, 0.75);
}
35% {
height: 2.5em;
box-shadow: 0.5em 0 rgba(61, 184, 143, 0.75), -0.5em 0 rgba(233, 169, 32, 0.75);
}
70% {
height: 0.5em;
box-shadow: 0.5em -1em rgba(61, 184, 143, 0.75), -0.5em 1em rgba(233, 169, 32, 0.75);
}
100% {
box-shadow: 0.5em 1em rgba(61, 184, 143, 0.75), -0.5em -1em rgba(233, 169, 32, 0.75);
}
}
.loader {
position: absolute;
top: calc(50% - 1.25em);
left: calc(50% - 1.25em);
}
.loader {
position: relative;
width: 2.5em;
height: 2.5em;
transform: rotate(165deg);
}
.loader:before, .loader:after {
content: "";
position: absolute;
top: 50%;
left: 50%;
display: block;
width: 0.5em;
height: 0.5em;
border-radius: 0.25em;
transform: translate(-50%, -50%);
}
.loader:before {
animation: before8 2s infinite;
}
.loader:after {
animation: after6 2s infinite;
}
@keyframes before8 {
0% {
width: 0.5em;
box-shadow: 1em -0.5em rgba(225, 20, 98, 0.75), -1em 0.5em rgba(111, 202, 220, 0.75);
}
35% {
width: 2.5em;
box-shadow: 0 -0.5em rgba(225, 20, 98, 0.75), 0 0.5em rgba(111, 202, 220, 0.75);
}
70% {
width: 0.5em;
box-shadow: -1em -0.5em rgba(225, 20, 98, 0.75), 1em 0.5em rgba(111, 202, 220, 0.75);
}
100% {
box-shadow: 1em -0.5em rgba(225, 20, 98, 0.75), -1em 0.5em rgba(111, 202, 220, 0.75);
}
}
@keyframes after6 {
0% {
height: 0.5em;
box-shadow: 0.5em 1em rgba(61, 184, 143, 0.75), -0.5em -1em rgba(233, 169, 32, 0.75);
}
35% {
height: 2.5em;
box-shadow: 0.5em 0 rgba(61, 184, 143, 0.75), -0.5em 0 rgba(233, 169, 32, 0.75);
}
70% {
height: 0.5em;
box-shadow: 0.5em -1em rgba(61, 184, 143, 0.75), -0.5em 1em rgba(233, 169, 32, 0.75);
}
100% {
box-shadow: 0.5em 1em rgba(61, 184, 143, 0.75), -0.5em -1em rgba(233, 169, 32, 0.75);
}
}
.loader {
position: absolute;
top: calc(50% - 1.25em);
left: calc(50% - 1.25em);
}
👍1
Dev_html
Photo
Html :-
<label class="ui-switch">
<input type="checkbox">
<div class="slider">
<div class="circle"></div>
</div>
</label>
<label class="ui-switch">
<input type="checkbox">
<div class="slider">
<div class="circle"></div>
</div>
</label>
Css:-
/* switch settings 👇 */
.ui-switch {
/* switch */
--switch-bg: rgb(135, 150, 165);
--switch-width: 48px;
--switch-height: 20px;
/* circle */
--circle-diameter: 32px;
--circle-bg: rgb(0, 56, 146);
--circle-inset: calc((var(--circle-diameter) - var(--switch-height)) / 2);
}
.ui-switch input {
display: none;
}
.slider {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
width: var(--switch-width);
height: var(--switch-height);
background: var(--switch-bg);
border-radius: 999px;
position: relative;
cursor: pointer;
}
.slider .circle {
top: calc(var(--circle-inset) * -1);
left: 0;
width: var(--circle-diameter);
height: var(--circle-diameter);
position: absolute;
background: var(--circle-bg);
border-radius: inherit;
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHdpZHRoPSIyMCIgdmlld0JveD0iMCAwIDIwIDIwIj4KICAgIDxwYXRoIGZpbGw9IiNmZmYiCiAgICAgICAgZD0iTTkuMzA1IDEuNjY3VjMuNzVoMS4zODlWMS42NjdoLTEuMzl6bS00LjcwNyAxLjk1bC0uOTgyLjk4Mkw1LjA5IDYuMDcybC45ODItLjk4Mi0xLjQ3My0xLjQ3M3ptMTAuODAyIDBMMTMuOTI3IDUuMDlsLjk4Mi45ODIgMS40NzMtMS40NzMtLjk4Mi0uOTgyek0xMCA1LjEzOWE0Ljg3MiA0Ljg3MiAwIDAwLTQuODYyIDQuODZBNC44NzIgNC44NzIgMCAwMDEwIDE0Ljg2MiA0Ljg3MiA0Ljg3MiAwIDAwMTQuODYgMTAgNC44NzIgNC44NzIgMCAwMDEwIDUuMTM5em0wIDEuMzg5QTMuNDYyIDMuNDYyIDAgMDExMy40NzEgMTBhMy40NjIgMy40NjIgMCAwMS0zLjQ3MyAzLjQ3MkEzLjQ2MiAzLjQ2MiAwIDAxNi41MjcgMTAgMy40NjIgMy40NjIgMCAwMTEwIDYuNTI4ek0xLjY2NSA5LjMwNXYxLjM5aDIuMDgzdi0xLjM5SDEuNjY2em0xNC41ODMgMHYxLjM5aDIuMDg0di0xLjM5aC0yLjA4NHpNNS4wOSAxMy45MjhMMy42MTYgMTUuNGwuOTgyLjk4MiAxLjQ3My0xLjQ3My0uOTgyLS45ODJ6bTkuODIgMGwtLjk4Mi45ODIgMS40NzMgMS40NzMuOTgyLS45ODItMS40NzMtMS40NzN6TTkuMzA1IDE2LjI1djIuMDgzaDEuMzg5VjE2LjI1aC0xLjM5eiIgLz4KPC9zdmc+");
background-repeat: no-repeat;
background-position: center center;
-webkit-transition: left 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
-o-transition: left 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: left 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
box-shadow: 0px 2px 1px -1px rgba(0,0,0,0.2), 0px 1px 1px 0px rgba(0,0,0,0.14), 0px 1px 3px 0px rgba(0,0,0,0.12);
;
}
.slider .circle::before {
content: "";
position: absolute;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.75);
border-radius: inherit;
-webkit-transition: all 500ms;
-o-transition: all 500ms;
transition: all 500ms;
opacity: 0;
}
/* actions */
.ui-switch input:checked+.slider .circle {
left: calc(100% - var(--circle-diameter));
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHdpZHRoPSIyMCIgdmlld0JveD0iMCAwIDIwIDIwIj4KICAgIDxwYXRoIGZpbGw9IiNmZmYiCiAgICAgICAgZD0iTTQuMiAyLjVsLS43IDEuOC0xLjguNyAxLjguNy43IDEuOC42LTEuOEw2LjcgNWwtMS45LS43LS42LTEuOHptMTUgOC4zYTYuNyA2LjcgMCAxMS02LjYtNi42IDUuOCA1LjggMCAwMDYuNiA2LjZ6IiAvPgo8L3N2Zz4=");
}
.ui-switch input:active+.slider .circle::before {
-webkit-transition: 0s;
-o-transition: 0s;
transition: 0s;
opacity: 1;
width: 0;
height: 0;
}
/* switch settings 👇 */
.ui-switch {
/* switch */
--switch-bg: rgb(135, 150, 165);
--switch-width: 48px;
--switch-height: 20px;
/* circle */
--circle-diameter: 32px;
--circle-bg: rgb(0, 56, 146);
--circle-inset: calc((var(--circle-diameter) - var(--switch-height)) / 2);
}
.ui-switch input {
display: none;
}
.slider {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
width: var(--switch-width);
height: var(--switch-height);
background: var(--switch-bg);
border-radius: 999px;
position: relative;
cursor: pointer;
}
.slider .circle {
top: calc(var(--circle-inset) * -1);
left: 0;
width: var(--circle-diameter);
height: var(--circle-diameter);
position: absolute;
background: var(--circle-bg);
border-radius: inherit;
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHdpZHRoPSIyMCIgdmlld0JveD0iMCAwIDIwIDIwIj4KICAgIDxwYXRoIGZpbGw9IiNmZmYiCiAgICAgICAgZD0iTTkuMzA1IDEuNjY3VjMuNzVoMS4zODlWMS42NjdoLTEuMzl6bS00LjcwNyAxLjk1bC0uOTgyLjk4Mkw1LjA5IDYuMDcybC45ODItLjk4Mi0xLjQ3My0xLjQ3M3ptMTAuODAyIDBMMTMuOTI3IDUuMDlsLjk4Mi45ODIgMS40NzMtMS40NzMtLjk4Mi0uOTgyek0xMCA1LjEzOWE0Ljg3MiA0Ljg3MiAwIDAwLTQuODYyIDQuODZBNC44NzIgNC44NzIgMCAwMDEwIDE0Ljg2MiA0Ljg3MiA0Ljg3MiAwIDAwMTQuODYgMTAgNC44NzIgNC44NzIgMCAwMDEwIDUuMTM5em0wIDEuMzg5QTMuNDYyIDMuNDYyIDAgMDExMy40NzEgMTBhMy40NjIgMy40NjIgMCAwMS0zLjQ3MyAzLjQ3MkEzLjQ2MiAzLjQ2MiAwIDAxNi41MjcgMTAgMy40NjIgMy40NjIgMCAwMTEwIDYuNTI4ek0xLjY2NSA5LjMwNXYxLjM5aDIuMDgzdi0xLjM5SDEuNjY2em0xNC41ODMgMHYxLjM5aDIuMDg0di0xLjM5aC0yLjA4NHpNNS4wOSAxMy45MjhMMy42MTYgMTUuNGwuOTgyLjk4MiAxLjQ3My0xLjQ3My0uOTgyLS45ODJ6bTkuODIgMGwtLjk4Mi45ODIgMS40NzMgMS40NzMuOTgyLS45ODItMS40NzMtMS40NzN6TTkuMzA1IDE2LjI1djIuMDgzaDEuMzg5VjE2LjI1aC0xLjM5eiIgLz4KPC9zdmc+");
background-repeat: no-repeat;
background-position: center center;
-webkit-transition: left 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
-o-transition: left 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
transition: left 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, -webkit-transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
box-shadow: 0px 2px 1px -1px rgba(0,0,0,0.2), 0px 1px 1px 0px rgba(0,0,0,0.14), 0px 1px 3px 0px rgba(0,0,0,0.12);
;
}
.slider .circle::before {
content: "";
position: absolute;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.75);
border-radius: inherit;
-webkit-transition: all 500ms;
-o-transition: all 500ms;
transition: all 500ms;
opacity: 0;
}
/* actions */
.ui-switch input:checked+.slider .circle {
left: calc(100% - var(--circle-diameter));
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHdpZHRoPSIyMCIgdmlld0JveD0iMCAwIDIwIDIwIj4KICAgIDxwYXRoIGZpbGw9IiNmZmYiCiAgICAgICAgZD0iTTQuMiAyLjVsLS43IDEuOC0xLjguNyAxLjguNy43IDEuOC42LTEuOEw2LjcgNWwtMS45LS43LS42LTEuOHptMTUgOC4zYTYuNyA2LjcgMCAxMS02LjYtNi42IDUuOCA1LjggMCAwMDYuNiA2LjZ6IiAvPgo8L3N2Zz4=");
}
.ui-switch input:active+.slider .circle::before {
-webkit-transition: 0s;
-o-transition: 0s;
transition: 0s;
opacity: 1;
width: 0;
height: 0;
}
Dev_html
Photo
Html :-
<div class="loader">
<div data-glitch="Loading..." class="glitch">Loading...</div>
</div>
<div class="loader">
<div data-glitch="Loading..." class="glitch">Loading...</div>
</div>
Css :-
.glitch {
position: relative;
font-size: 25px;
font-weight: 700;
line-height: 1.2;
color: #fff;
letter-spacing: 5px;
z-index: 1;
animation: shift 1s ease-in-out infinite alternate;
}
.glitch:before,
.glitch:after {
display: block;
content: attr(data-glitch);
position: absolute;
top: 0;
left: 0;
opacity: 0.8;
}
.glitch:before {
animation: glitch 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
color: #8b00ff;
z-index: -1;
}
.glitch:after {
animation: glitch 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) reverse both infinite;
color: #00e571;
z-index: -2;
}
@keyframes glitch {
0% {
transform: translate(0);
}
20% {
transform: translate(-3px, 3px);
}
40% {
transform: translate(-3px, -3px);
}
60% {
transform: translate(3px, 3px);
}
80% {
transform: translate(3px, -3px);
}
to {
transform: translate(0);
}
}
@keyframes shift {
0%, 40%, 44%, 58%, 61%, 65%, 69%, 73%, 100% {
transform: skewX(0deg);
}
41% {
transform: skewX(10deg);
}
42% {
transform: skewX(-10deg);
}
59% {
transform: skewX(40deg) skewY(10deg);
}
60% {
transform: skewX(-40deg) skewY(-10deg);
}
63% {
transform: skewX(10deg) skewY(-5deg);
}
70% {
transform: skewX(-50deg) skewY(-20deg);
}
71% {
transform: skewX(10deg) skewY(-10deg);
}
}
.glitch {
position: relative;
font-size: 25px;
font-weight: 700;
line-height: 1.2;
color: #fff;
letter-spacing: 5px;
z-index: 1;
animation: shift 1s ease-in-out infinite alternate;
}
.glitch:before,
.glitch:after {
display: block;
content: attr(data-glitch);
position: absolute;
top: 0;
left: 0;
opacity: 0.8;
}
.glitch:before {
animation: glitch 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
color: #8b00ff;
z-index: -1;
}
.glitch:after {
animation: glitch 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) reverse both infinite;
color: #00e571;
z-index: -2;
}
@keyframes glitch {
0% {
transform: translate(0);
}
20% {
transform: translate(-3px, 3px);
}
40% {
transform: translate(-3px, -3px);
}
60% {
transform: translate(3px, 3px);
}
80% {
transform: translate(3px, -3px);
}
to {
transform: translate(0);
}
}
@keyframes shift {
0%, 40%, 44%, 58%, 61%, 65%, 69%, 73%, 100% {
transform: skewX(0deg);
}
41% {
transform: skewX(10deg);
}
42% {
transform: skewX(-10deg);
}
59% {
transform: skewX(40deg) skewY(10deg);
}
60% {
transform: skewX(-40deg) skewY(-10deg);
}
63% {
transform: skewX(10deg) skewY(-5deg);
}
70% {
transform: skewX(-50deg) skewY(-20deg);
}
71% {
transform: skewX(10deg) skewY(-10deg);
}
}
Html :-
<div class="loader">
<div class="box box-1">
<div class="side-left"></div>
<div class="side-right"></div>
<div class="side-top"></div>
</div>
<div class="box box-2">
<div class="side-left"></div>
<div class="side-right"></div>
<div class="side-top"></div>
</div>
<div class="box box-3">
<div class="side-left"></div>
<div class="side-right"></div>
<div class="side-top"></div>
</div>
<div class="box box-4">
<div class="side-left"></div>
<div class="side-right"></div>
<div class="side-top"></div>
</div>
</div>
<div class="loader">
<div class="box box-1">
<div class="side-left"></div>
<div class="side-right"></div>
<div class="side-top"></div>
</div>
<div class="box box-2">
<div class="side-left"></div>
<div class="side-right"></div>
<div class="side-top"></div>
</div>
<div class="box box-3">
<div class="side-left"></div>
<div class="side-right"></div>
<div class="side-top"></div>
</div>
<div class="box box-4">
<div class="side-left"></div>
<div class="side-right"></div>
<div class="side-top"></div>
</div>
</div>
Css :-
/* 3D tower loader made by: csozi | Website: www.csozi.hu*/
.loader {
scale: 3;
height: 50px;
width: 40px;
}
.box {
position: relative;
opacity: 0;
left: 10px;
}
.side-left {
position: absolute;
background-color: #286cb5;
width: 19px;
height: 5px;
transform: skew(0deg, -25deg);
top: 14px;
left: 10px;
}
.side-right {
position: absolute;
background-color: #2f85e0;
width: 19px;
height: 5px;
transform: skew(0deg, 25deg);
top: 14px;
left: -9px;
}
.side-top {
position: absolute;
background-color: #5fa8f5;
width: 20px;
height: 20px;
rotate: 45deg;
transform: skew(-20deg, -20deg);
}
.box-1 {
animation: from-left 4s infinite;
}
.box-2 {
animation: from-right 4s infinite;
animation-delay: 1s;
}
.box-3 {
animation: from-left 4s infinite;
animation-delay: 2s;
}
.box-4 {
animation: from-right 4s infinite;
animation-delay: 3s;
}
@keyframes from-left {
0% {
z-index: 20;
opacity: 0;
translate: -20px -6px;
}
20% {
z-index: 10;
opacity: 1;
translate: 0px 0px;
}
40% {
z-index: 9;
translate: 0px 4px;
}
60% {
z-index: 8;
translate: 0px 8px;
}
80% {
z-index: 7;
opacity: 1;
translate: 0px 12px;
}
100% {
z-index: 5;
translate: 0px 30px;
opacity: 0;
}
}
@keyframes from-right {
0% {
z-index: 20;
opacity: 0;
translate: 20px -6px;
}
20% {
z-index: 10;
opacity: 1;
translate: 0px 0px;
}
40% {
z-index: 9;
translate: 0px 4px;
}
60% {
z-index: 8;
translate: 0px 8px;
}
80% {
z-index: 7;
opacity: 1;
translate: 0px 12px;
}
100% {
z-index: 5;
translate: 0px 30px;
opacity: 0;
}
}
/* 3D tower loader made by: csozi | Website: www.csozi.hu*/
.loader {
scale: 3;
height: 50px;
width: 40px;
}
.box {
position: relative;
opacity: 0;
left: 10px;
}
.side-left {
position: absolute;
background-color: #286cb5;
width: 19px;
height: 5px;
transform: skew(0deg, -25deg);
top: 14px;
left: 10px;
}
.side-right {
position: absolute;
background-color: #2f85e0;
width: 19px;
height: 5px;
transform: skew(0deg, 25deg);
top: 14px;
left: -9px;
}
.side-top {
position: absolute;
background-color: #5fa8f5;
width: 20px;
height: 20px;
rotate: 45deg;
transform: skew(-20deg, -20deg);
}
.box-1 {
animation: from-left 4s infinite;
}
.box-2 {
animation: from-right 4s infinite;
animation-delay: 1s;
}
.box-3 {
animation: from-left 4s infinite;
animation-delay: 2s;
}
.box-4 {
animation: from-right 4s infinite;
animation-delay: 3s;
}
@keyframes from-left {
0% {
z-index: 20;
opacity: 0;
translate: -20px -6px;
}
20% {
z-index: 10;
opacity: 1;
translate: 0px 0px;
}
40% {
z-index: 9;
translate: 0px 4px;
}
60% {
z-index: 8;
translate: 0px 8px;
}
80% {
z-index: 7;
opacity: 1;
translate: 0px 12px;
}
100% {
z-index: 5;
translate: 0px 30px;
opacity: 0;
}
}
@keyframes from-right {
0% {
z-index: 20;
opacity: 0;
translate: 20px -6px;
}
20% {
z-index: 10;
opacity: 1;
translate: 0px 0px;
}
40% {
z-index: 9;
translate: 0px 4px;
}
60% {
z-index: 8;
translate: 0px 8px;
}
80% {
z-index: 7;
opacity: 1;
translate: 0px 12px;
}
100% {
z-index: 5;
translate: 0px 30px;
opacity: 0;
}
}
Html :-
<p class="component-title">iOS Switch</p>
<div class="container">
<input type="checkbox" class="checkbox" id="checkbox">
<label class="switch" for="checkbox">
<span class="slider"></span>
</label>
</div>
<p class="component-title">iOS Switch</p>
<div class="container">
<input type="checkbox" class="checkbox" id="checkbox">
<label class="switch" for="checkbox">
<span class="slider"></span>
</label>
</div>
Css :-
/* Remove this container when use*/
.component-title {
width: 100%;
position: absolute;
z-index: 999;
top: 30px;
left: 0;
padding: 0;
margin: 0;
font-size: 1rem;
font-weight: 700;
color: #888;
text-align: center;
}
/* The switch - the box around the slider */
.container {
width: 51px;
height: 31px;
position: relative;
}
/* Hide default HTML checkbox */
.checkbox {
opacity: 0;
width: 0;
height: 0;
position: absolute;
}
.switch {
width: 100%;
height: 100%;
display: block;
background-color: #e9e9eb;
border-radius: 16px;
cursor: pointer;
transition: all 0.2s ease-out;
}
/* The slider */
.slider {
width: 27px;
height: 27px;
position: absolute;
left: calc(50% - 27px/2 - 10px);
top: calc(50% - 27px/2);
border-radius: 50%;
background: #FFFFFF;
box-shadow: 0px 3px 8px rgba(0, 0, 0, 0.15), 0px 3px 1px rgba(0, 0, 0, 0.06);
transition: all 0.2s ease-out;
cursor: pointer;
}
.checkbox:checked + .switch {
background-color: #34C759;
}
.checkbox:checked + .switch .slider {
left: calc(50% - 27px/2 + 10px);
top: calc(50% - 27px/2);
}
/* Remove this container when use*/
.component-title {
width: 100%;
position: absolute;
z-index: 999;
top: 30px;
left: 0;
padding: 0;
margin: 0;
font-size: 1rem;
font-weight: 700;
color: #888;
text-align: center;
}
/* The switch - the box around the slider */
.container {
width: 51px;
height: 31px;
position: relative;
}
/* Hide default HTML checkbox */
.checkbox {
opacity: 0;
width: 0;
height: 0;
position: absolute;
}
.switch {
width: 100%;
height: 100%;
display: block;
background-color: #e9e9eb;
border-radius: 16px;
cursor: pointer;
transition: all 0.2s ease-out;
}
/* The slider */
.slider {
width: 27px;
height: 27px;
position: absolute;
left: calc(50% - 27px/2 - 10px);
top: calc(50% - 27px/2);
border-radius: 50%;
background: #FFFFFF;
box-shadow: 0px 3px 8px rgba(0, 0, 0, 0.15), 0px 3px 1px rgba(0, 0, 0, 0.06);
transition: all 0.2s ease-out;
cursor: pointer;
}
.checkbox:checked + .switch {
background-color: #34C759;
}
.checkbox:checked + .switch .slider {
left: calc(50% - 27px/2 + 10px);
top: calc(50% - 27px/2);
}
Html :-
<button>
<div>
<span>
<p>Hover Me</p><p>:)</p>
</span>
</div>
<div>
<span>
<p>Thanks</p><p>:D</p>
</span>
</div>
</button>
<button>
<div>
<span>
<p>Hover Me</p><p>:)</p>
</span>
</div>
<div>
<span>
<p>Thanks</p><p>:D</p>
</span>
</div>
</button>
Css :-
button {
outline: 0;
border: 0;
display: flex;
flex-direction: column;
width: 100%;
max-width: 140px;
height: 50px;
border-radius: 0.5em;
box-shadow: 0 0.625em 1em 0 rgba(30, 143, 255, 0.35);
overflow: hidden;
}
button div {
transform: translateY(0px);
width: 100%;
}
button,
button div {
transition: 0.6s cubic-bezier(.16,1,.3,1);
}
button div span {
display: flex;
align-items: center;
justify-content: space-between;
height: 50px;
padding: 0.75em 1.125em;
}
button div:nth-child(1) {
background-color: #1e90ff;
}
button div:nth-child(2) {
background-color: #21dc62;
}
button:hover {
box-shadow: 0 0.625em 1em 0 rgba(33, 220, 98, 0.35);
}
button:hover div {
transform: translateY(-50px);
}
button p {
font-size: 17px;
font-weight: bold;
color: #ffffff;
}
button:active {
transform: scale(0.95);
}
button {
outline: 0;
border: 0;
display: flex;
flex-direction: column;
width: 100%;
max-width: 140px;
height: 50px;
border-radius: 0.5em;
box-shadow: 0 0.625em 1em 0 rgba(30, 143, 255, 0.35);
overflow: hidden;
}
button div {
transform: translateY(0px);
width: 100%;
}
button,
button div {
transition: 0.6s cubic-bezier(.16,1,.3,1);
}
button div span {
display: flex;
align-items: center;
justify-content: space-between;
height: 50px;
padding: 0.75em 1.125em;
}
button div:nth-child(1) {
background-color: #1e90ff;
}
button div:nth-child(2) {
background-color: #21dc62;
}
button:hover {
box-shadow: 0 0.625em 1em 0 rgba(33, 220, 98, 0.35);
}
button:hover div {
transform: translateY(-50px);
}
button p {
font-size: 17px;
font-weight: bold;
color: #ffffff;
}
button:active {
transform: scale(0.95);
}