JSFiddle - React, Tailwind, and code Playground
HTML
<div id="bgimg"></div>
CSS
html,body {
padding:0;
margin:0;
width:100%;
height:100%;
}
#bgimg {
position:fixed;
top:50%; left:50%;
z-index: -1;
background: url("http://i.imgur.com/pEyv9Br.jpg") center center no-repeat;
-webkit-animation:spin 150s linear infinite;
-moz-animation:spin 150s linear infinite;
animation:spin 150s linear infinite;
-moz-transform-origin:center center;
-webkit-transform-origin:center center;
transform-origin:center center;
}
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
@keyframes spin { 100% { transform:rotate(360deg); } }
JavaScript
var bg = document.getElementById("bgimg");
window.onresize = function() {
/* Compare values and set width/height based on higher value */
var max = Math.max(window.innerWidth, window.innerHeight);
bg.style.width = 2.5*max + "px";
bg.style.height = 2.5*max + "px";
bg.style.marginTop = -1.25*max + "px";
bg.style.marginLeft = -1.25*max + "px";
}
window.onresize();