#image { position: relative; >.true-img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: var(--objFit); } @keyframes rotate { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(360deg); } } >.loading-img { position: absolute; width: 20px; height: 20px; max-width: 100%; max-width: 100%; left: 50%; top: 50%; transform: translate(-50%, -50%); object-fit: contain; animation: rotate 3s linear 0s infinite normal forwards; } }