Skip to content

Instantly share code, notes, and snippets.

@Jw-44
Created July 30, 2022 13:53
Show Gist options
  • Save Jw-44/b10015cc047ca180cc68d5dff42df325 to your computer and use it in GitHub Desktop.
Save Jw-44/b10015cc047ca180cc68d5dff42df325 to your computer and use it in GitHub Desktop.
Elegant CTA button animation
.clickmeplease {
display: inline-block;
position: relative;
opacity: 1;
margin: .3em;
padding: .5em 1.5em;
border-radius: 6px;
transition: all 0.3s;
cursor: pointer;
font-size: 2rem;
background-color: transparent;
border: 2px solid rgba(0,0,0,.2);
color: #999;
font-weight: 400;
}
.clickmeplease:before,
.clickmeplease:after {
content: '';
border-style: solid;
position: absolute;
z-index: 5;
border-radius: 6px;
box-sizing: content-box;
transition: all 0.3s;
}
.clickmeplease:before {
width: 0;
height: 100%;
border-width: 2px 0 2px 0;
top: -2px;
left: -2px;
transition-delay: 0.05s;
}
.clickmeplease:after {
width: 100%;
height: 0;
border-width: 0 2px 0 2px;
top: -2px;
left: -2px;
}
.clickmeplease:hover:after {
height: calc(100% + (2px * 2));
border-color: #30a987;
}
.clickmeplease:hover:before {
width: calc(100% + (2px * 2));
border-color: #30a987;
}
.clickmeplease:hover {
color: #30a987;
}
@Jw-44
Copy link
Author

Jw-44 commented Aug 3, 2022

Hover me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment