Skip to content

Donut Spinner using CSS

A donut spinner is a type of loading spinner that is shaped like a donut.

In this post, I will show you how to create a donut spinner using only CSS.

HTML

<div class="donut"></div>

CSS

@keyframes donut-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
  
.donut {
  display: inline-block;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-left-color: #7983ff;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: donut-spin 1.2s linear infinite;
}