JSFiddle - React, Tailwind, and code Playground
HTML
<div id="test"></div>
CSS
#test {
width: 200px;
height: 150px;
margin-top: 100px;
margin-left: 250px;
padding: 50px;
background: gray;
font-size: 120%;
}
JavaScript
var test = document.getElementById("test"),
rect = test.getBoundingClientRect();
var str = "";
for (i in rect) {
str += i + " = " + rect[i] + "<br>";
}
test.innerHTML = str;