← Back
css gist

Simple pure css spinner

The CSS:

spinner.css:

.spinner,
.spinner:after
{
border-radius: 50%;
width: 10em;
height: 10em;
}

.spinner {
margin: 60px auto;
font-size: 10px;
position: relative;
text-indent: -9999em;
border-top: 1.1em solid rgba(0, 0, 0, 0.2);
border-right: 1.1em solid rgba(0, 0, 0, 0.2);
border-bottom: 1.1em solid rgba(0, 0, 0, 0.2);
border-left: 1.1em solid rgba(0, 0, 0, 0.6);
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
-webkit-animation: spin 2.1s infinite linear;
animation: spin 2.1s infinite linear;
}

@keyframes spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}

React example:

Spinner.jsx:

import React from "react";
import "./spinner.css";

const Spinner = () => <div className="spinner"></div>;

export default Spinner;

Source: https://projects.lukehaas.me/css-loaders/