JSFiddle - React, Tailwind, and code Playground

by David Thomas

HTML

<div id="demo"></div>

CSS

div {
    height: 500px;
    width: 500px;
    margin: 0 auto;
    background: #fff url(http://placekitten.com/300/300) 50% 50% no-repeat;
}

JavaScript

var demo = document.getElementById('demo'),
    _tmp = window.getComputedStyle(demo,null).backgroundPosition.replace(/^\s+|\s+$/g,'').split(/\s+/),
    positions = {
        'left' : _tmp[0],
        'top' : _tmp[1]
    };
console.log(positions, positions.left, positions.top);