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 clientWidth = document.getElementById('container').clientWidth;
var clientHeight = document.getElementById('container').clientHeight;
alert(`${clientWidth} x ${clientHeight}`);