<div class="spinner"></div>
body {
  display: grid;
  height: 100vh;
  place-items: center;
  background-color: #e1f5fe;
}
.spinner {
  box-shadow: 0 0 0 7px #42a5f5, inset 0 0 0 1px #42a5f5;
  position: relative;
  height: 50px;
  width: 240px;
  border-radius: 8px;
  overflow: hidden;
  animation: rotate 6s linear infinite;
}
.spinner:before {
  display: block;
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background-color: #42a5f5;
  animation: load 6s linear infinite;
}
@keyframes rotate {
  0%,
  42% {
    transform: rotate(0deg);
  }
  48%,
  92% {
    transform: rotate(180deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
@keyframes load {
  0% {
    width: 0;
  }
  40%,
  50% {
    width: 100%;
  }
  90%,
  100% {
    width: 0;
  }
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.