Code Snippet
Using pure CSS animation you can create a loading spinner for your site.
HTML
<div class="my_loader"></div>
CSS
Full URL example:
.my_loader {
border: #eaeaea solid 10px;
border-radius: 50%;
border-top: #ff0000 solid 10px;
width: 60px;
height: 60px;
animation: my_spinner 1s linear infinite;
}
@keyframes my_spinner {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
Example
CSS Notes:
- The “inherit”, “initial” and “unset” keywords can be used with any CSS property to set its value
- In CSS there are many ways to express a color value in a property
We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.