Skip to content

Instantly share code, notes, and snippets.

@jlis
Last active December 10, 2018 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlis/acdfa149380e21a41a22d7297284011c to your computer and use it in GitHub Desktop.
Save jlis/acdfa149380e21a41a22d7297284011c to your computer and use it in GitHub Desktop.
CSS loading animation
// https://css-tricks.com/building-skeleton-screens-css-custom-properties/
.loading {
position: relative;
width: 100%;
display: block;
margin: 0 0 10px;
height: 20px;
&--inner {
position: relative;
width: 100%;
height: inherit;
border-radius: 3px;
animation-duration: 1.25s;
animation-fill-mode: forwards;
animation-iteration-count: infinite;
animation-name: loading;
animation-timing-function: linear;
background: darkgray;
background: linear-gradient(to right, #e0e0e0 10%, #d0d0d0 18%, #e0e0e0 33%);
background-size: 800px 104px;
}
}
@keyframes loading {
0% {
background-position: -468px 0;
}
100% {
background-position: 468px 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment