JSFiddle - React, Tailwind, and code Playground

HTML

<div id="div">
123
</div>

CSS

#div{
    width: 100px;
    height: 120px;
    background-color:yellow;
    transform-origin: 0 0;
    transform: rotateZ(45deg);
  
}

JavaScript

var o = document.getElementById("div");
var h = o.offsetHeight;  //高度
var w = o.offsetWidth;  //宽度

console.log(h);
console.log(w);