JSFiddle - React, Tailwind, and code Playground

by techiedelight

HTML

<div id="container" class="main-class"></div>

CSS

.main-class {
  border: 1px solid gray;
  width: 500px;
  height: 100px;
  padding: 10px;
}

JavaScript

var offsetWidth = document.getElementById('container').offsetWidth;
var offsetHeight = document.getElementById('container').offsetHeight;
alert(`${offsetWidth} x ${offsetHeight}`);