Practical uses
Some inspiration
Here we have 4 loading spinners which you might recognise from the
Internet.
Each of these were created with pure CSS.
The first 3 with a single element each.
.circle-loader {
width: 100px;
height: 100px;
border-radius: 50%;
border-top: 10px solid rgba(255, 255, 255, 0.2);
border-right: 10px solid rgba(255, 255, 255, 0.2);
border-bottom: 10px solid rgba(255, 255, 255, 0.2);
border-left: 10px solid rgba(255, 255, 255, 1);
transform: translateZ(0);
animation: circle-loader-spin 1s infinite linear;
}
@keyframes circle-loader-spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
Using simple, every day CSS primitives, we are able to create more
complex shapes by tweaking parameters.
Animating DOM elements with CSS should provide a smoother, more
fluid animation than with JavaScript.