Skip to content

Instantly share code, notes, and snippets.

@davidglezz
Last active September 9, 2023 14:50
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 davidglezz/85a2e6185edbd0873a5a2bdb2ce1cd36 to your computer and use it in GitHub Desktop.
Save davidglezz/85a2e6185edbd0873a5a2bdb2ce1cd36 to your computer and use it in GitHub Desktop.
Basic CSS Loader
<div class="loader"></div>
<style>
.loader {
--size: 5rem;
--weight: .5rem;
--background: rgba(127, 127, 127, .1);
--color: rgba(127, 127, 127, .9);
--duration: 1s;
position: fixed;
top: calc(50% - var(--size) / 2);
left: calc(50% - var(--size) / 2);
width: var(--size);
height: var(--size);
box-sizing: border-box;
border: solid var(--weight) var(--background);
border-top-color: var(--color);
border-radius: 50%;
animation: loader var(--duration) linear infinite;
}
@keyframes loader {
to {
transform: rotate(360deg);
}
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment