CSS Animations are a feature that’s been around for a few years, but not many web developers know about it. CSS Animations allow you to define animations and transitions for HTML elements without the need to write JavaScript to do it, or even create an animated GIF file.

Yes, the below spinner in this page is all CSS:

Here’s a simple Loading Spinner using a simple CSS Animation:

    <script src="http://code.jquery.com/jquery-2.1.3.js"></script>
        @keyframes spin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        .spinner {
            animation: spin 1s infinite linear;
            width: 1em;
            height: 1em;
        .spinner.stop {
            /* when this class is applied the animation will stop */
            animation: none;
        .circle {
            border: solid 0.05em black;
            width: 1em;
            height: 1em;
            border-radius: 1em;
            border-left: none;
            border-bottom: none;
            border-right: none;
        $(function () {
            $('button').click(function () {
    <div class="spinner">
        <div class="circle"></div>
    <button>Toggle Animation</button>

I hope this helps! :)