Skip to content

Instantly share code, notes, and snippets.

@zeshhaan
Created July 1, 2021 12:11
Show Gist options
  • Save zeshhaan/6d47d556d2b5a6b64e7dba334c7d4779 to your computer and use it in GitHub Desktop.
Save zeshhaan/6d47d556d2b5a6b64e7dba334c7d4779 to your computer and use it in GitHub Desktop.
Shiny Button
.button-shine {
position: relative;
border: 0;
padding: 0.8rem 1.3rem;
border-radius: 4px;
cursor: pointer;
overflow: hidden;
outline: none;
box-shadow: 0 8px 32px rgba(0,0,0,0.2);
transition: all 0.2s ease;
}
.button-shine:after {
content: '';
position: absolute;
top: 0;
left: -200%;
width: 200%;
height: 100%;
transform: skewX(-20deg);
background-image: linear-gradient(to right, transparent, rgba(255,255,255,0.3), transparent);
}
.button-shine:hover:after {
animation: shine 1.6s ease;
}
.button-shine:active {
transform: translateY(1px);
box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.cntr {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
@-moz-keyframes shine {
100% {
left: 200%;
}
}
@-webkit-keyframes shine {
100% {
left: 200%;
}
}
@-o-keyframes shine {
100% {
left: 200%;
}
}
@keyframes shine {
100% {
left: 200%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment