Skip to content

Instantly share code, notes, and snippets.

@dmy3k
Last active August 29, 2015 14:23
Show Gist options
  • Save dmy3k/6213cbd1112c2a8131a9 to your computer and use it in GitHub Desktop.
Save dmy3k/6213cbd1112c2a8131a9 to your computer and use it in GitHub Desktop.
Zero element CSS loader
.loading {
position: relative;
}
.loading:before {
content: "";
display: block;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background: rgba(255,255,255,0.75);
z-index: 1010;
}
.loading:after {
content: "";
display: block;
position: absolute;
top: 50%;
left: 50%;
width: 42px;
height: 42px;
margin: -21px 0 0 -21px;
z-index: 1020;
background: url("loader.svg");
background-size: contain;
background-position: 50% 50%;
-webkit-animation-name: spin;
-webkit-animation-duration: 600ms;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
-moz-animation-name: spin;
-moz-animation-duration: 600ms;
-moz-animation-iteration-count: infinite;
-moz-animation-timing-function: linear;
-ms-animation-name: spin;
-ms-animation-duration: 600ms;
-ms-animation-iteration-count: infinite;
-ms-animation-timing-function: linear;
}
@-moz-keyframes spin {
from { -moz-transform: rotate(0deg); }
to { -moz-transform: rotate(360deg); }
}
@-webkit-keyframes spin {
from { -webkit-transform: rotate(0deg); }
to { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
from {transform:rotate(0deg);}
to {transform:rotate(360deg);}
}
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment