JSFiddle - React, Tailwind, and code Playground
HTML
<div class="foo" id="foo">Foo</div>
<div class="fooText" id="fooText"></div>
CSS
* {
position:absolute;
}
.foo {
background-color:rgb(255,0,0);
border:2px dotted rgb(0,0,0);
height:40px;
top:100px;
width:100px;
}
.fooText {
border:1px solid rgb(0,0,0);
font-size:6px;
height:250px;
left:150px;
top:50px;
width:450px;
}
JavaScript
var test = (function() {
var foo = document.getElementById('foo');
var tempFoo = window.getComputedStyle(foo);
// tempFoo.cssText is empty in IE, and contains correct stuff in others
document.getElementById('fooText').innerHTML = tempFoo.cssText;
})();