CSS Snippets

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

Loading Spinner

CSS Notes:


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.