<style>
  * {
    box-sizing: border-box;
  }
  html, body {
    align-items: center;
    background: linear-gradient(45deg, #1f3a93, #dadfe1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 0;
    min-height: 100vh;
    padding: 0;
    width: 100vw;
  }
  div {
    height: 50px;
    margin: 40px;
    width: 50px;
  }
  h1 {
    color: #fafafa;
    font-family: 'Arial', sans-serif;
  }
</style>
<div></div>
<h1>Span 0 times!</h1>
div {
  background: #f62459;
  animation: spin .5s infinite linear;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
const spinner = document.querySelector('div')
const label = document.querySelector('h1')
let span = 0
const update = () => {
  span++
  label.innerText = `Span ${span} times!`
}

spinner.addEventListener('animationiteration', update)
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.