JSFiddle - React, Tailwind, and code Playground

HTML

<div class="button">
Button
</div>

CSS

.button {
  position: absolute;
  display: inline-block;
  border: 1px solid grey;
  padding: 20px;
}

.button::after {
    content: "";
    position: absolute;
    border: 8px solid #ddd;
    border-radius: 50%;
    border-top: 8px solid #008;
    border-bottom: 8px solid #008;
    width: 64px;
    height: 64px;
    animation: spin 2s linear infinite;  /* without the animation, everything is positioned perfectly */
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}