JSFiddle - React, Tailwind, and code Playground
by Ivanq
HTML
<section>
<div id="demo"></div>
<p id="technique"></p>
</section>
CSS
#demo {
width:100px;
height:100px;
background:url(https://developer.mozilla.org/media/uploads/demos/c/o/codepo8/3d78d077a51c2a79281111cdd3d0b0cc/browser-fountain_1314288268_demo_package/img/firefox.png) center center no-repeat #333;
margin:30px auto;
}
JavaScript
function init(elm) {
elm.style.animation = 'rotate 1s linear infinite';
var keyframes = '@keyframes rotate { from {transform:rotate( 0deg ) } to {transform:rotate( 360deg ) }}';
if(document.styleSheets && document.styleSheets.length) {
document.styleSheets[0].insertRule(keyframes, 0);
} else {
var s = document.createElement('style');
s.innerHTML = keyframes;
document.getElementsByTagName('head')[0].appendChild(s);
}
}
init(document.getElementById('demo'));