JSFiddle - React, Tailwind, and code Playground

HTML

<div id="example" style="width: 300px;">
    Some Content   
</div>

<div id="the_margin" style="font-weight: bold;">
    The div is centered?  
</div>

CSS

#example {
    margin: 0 auto;
    border: 1px solid #CCC;
}

JavaScript

function check_center( the_id ) {
    var result = "";
    var sheets = document.styleSheets;
    var attribute_style = $(the_id).attr( "style" );
    if(attribute_style.match(/margin:([a-z0-9- ]+?)auto/) || attribute_style.match(/margin:auto/) || (attribute_style.match(/margin-left:auto/) && attribute_style.match(/margin-right:auto/)) || (attribute_style.match(/margin-left: auto/) && attribute_style.match(/margin-right: auto/)) ) {
        result = "true";
    } else {
    the_id.matches = the_id.matches || the_id.webkitMatchesSelector || the_id.mozMatchesSelector || the_id.msMatchesSelector || the_id.oMatchesSelector;
    for (var i in sheets) {
        var rules = sheets[i].rules || sheets[i].cssRules;
        for (var r in rules) {
            if (the_id.matches(rules[r].selectorText)) {
                if(result != "true") {
                    if(rules[r].cssText.match(/margin:([a-z0-9- ]+?)auto/) || rules[r].cssText.match(/margin:auto/) || (rules[r].cssText.match(/margin-left:auto/) && rules[r].cssText.match(/margin-right:auto/)) || (rules[r].cssText.match(/margin-left: auto/) && rules[r].cssText.match(/margin-right: auto/)) ) {
                     result = "true";
                    } else {
                     result = "false";  
                    }
                }
            }
        }
    }
    }
    if(result == "") {
     result = "false";   
    }
    return result;
}

$( document ).ready(function() {
    $("#the_margin").append( check_center(document.getElementById('example')) );
});