Skip to content

Instantly share code, notes, and snippets.

Created September 25, 2014 16:20
Show Gist options
  • Save anonymous/84caede5d7d52a337996 to your computer and use it in GitHub Desktop.
Save anonymous/84caede5d7d52a337996 to your computer and use it in GitHub Desktop.
A Pen by A Non Ymous.
<button class="success" onclick="this.setAttribute('disabled', 'disabled');this.className='success loading';">SUBMIT</button>
button {
position: relative;
height: 50px;
line-height: 50px;
padding: 0px 30px;
border: none;
outline: none;
border-radius: 2px;
font-size: 14px;
cursor: pointer;
transition: all 0.2s;
}
button.success {
background-color: #74a26e;
color: white;
}
button.success:hover {
background-color: #51774c;
}
button:disabled:hover,
button:disabled {
cursor: default;
background-color: #EEEEEE;
color: #DDDDDD;
text-shadow: 1px 1px 1px #FFFFFF;
box-shadow: none;
}
button.loading {
padding-right: 60px;
}
button.loading:before, button.loading:after {
content: '';
position: absolute;
top: 50%;
right: 0;
bottom: 0;
width: 20px;
height: 20px;
margin-top: -10px;
margin-right: 30px;
border: 2px solid #DDDDDD;
border-radius: 50%;
box-sizing: border-box;
}
button.loading:after {
border-left-color: rgba(255, 255, 255, 0.8);
-webkit-animation: rotate 0.8s linear infinite;
-moz-animation: rotate 0.8s linear infinite;
animation: rotate 0.8s linear infinite;
}
@-webkit-keyframes rotate {
0% {
-webkit-transform: rotate(0);
}
100% {
-webkit-transform: rotate(360deg);
}
}
@-moz-keyframes rotate {
0% {
-moz-transform: rotate(0);
}
100% {
-moz-transform: rotate(360deg);
}
}
@keyframes rotate {
0% {
transform: rotate(0);
}
100% {
transform: rotate(360deg);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment