Last active
September 9, 2023 14:50
-
-
Save davidglezz/85a2e6185edbd0873a5a2bdb2ce1cd36 to your computer and use it in GitHub Desktop.
Basic CSS Loader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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