Back
A step-by-step guide to building a visually appealing spinning loader for your website using CSS animations and keyframes.
<div> element that will serve as the loader.
<div class="loader"></div>
.loader {
border: 4px solid #f3f3f3;
border-top-color: #e122a2;
border-bottom-color: #e122a2;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s ease-in-out infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
<div class="loader"></div>
<style>
.loader {
border: 8px solid #f3f3f3;
border-top-color: #e122a2;
border-bottom-color: #e122a2;
border-radius: 50%;
width: 20px;
height: 20px;
animation: spin 1s ease-in-out infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
Thank you for reading this article.
Comments
No comments yet. Be the first to comment!