Skip to content

Instantly share code, notes, and snippets.

@ascot21
Created July 9, 2013 20:49
Show Gist options
  • Save ascot21/5961142 to your computer and use it in GitHub Desktop.
Save ascot21/5961142 to your computer and use it in GitHub Desktop.
Loading spinner with CSS
<div id="loading"><div id="spinner"></div> <span>Loading...</span></div>
@-webkit-keyframes loading {
to { -webkit-transform: rotate(360deg); }
}
@-moz-keyframes loading {
to { -moz-transform: rotate(360deg); }
}
@-ms-keyframes loading {
to { -ms-transform: rotate(360deg); }
}
@keyframes loading {
to { transform: rotate(360deg); }
}
/* Loader (*/
#loading {
background: rgba(0,0,0,.7);
border-radius: 5px;
display: none;
margin: -20px 0 0 -65px;
padding:.5em .75em;
position: absolute;
top: 50%;
left: 50%;
width:9em;
#spinner {
width: 2em;
height: 2em;
display:block;
float:left;
border-radius: 50%;
background: transparent;
border-top: 4px solid #fff;
border-right: 4px solid #fff;
border-bottom: 4px solid #777;
border-left: 4px solid #777;
-webkit-animation: loading 1.2s infinite linear;
-moz-animation: loading 1.2s infinite linear;
-ms-animation: loading 1.2s infinite linear;
animation: loading 1.2s infinite linear;
}
span {
margin-left: .5em;
line-height: 175%
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment