I would like to know how can i get the original dimensions of a element after rotating it, when i use transform: rotate() and try to get the dimensions after rotate using element.getBoundingClientRect() it returns a different width and heigh, is it possible to get the real dimensions after rotating a element?
let div1 = document.getElementById('one') let div2 = document.getElementById('two') // Here the width and height is 50 and 80 console.log(div1.getBoundingClientRect()) // Here because i used transform rotate the width is 86 and height 94 console.log(div2.getBoundingClientRect()) div#one { width: 50px; height: 80px; background-color: red; } div#two { width: 50px; height: 80px; background-color: red; transform: rotate(35deg); } <div id="one"></div> <br/> <div id="two"></div>
getComputedStyle(element)["height"]andgetComputedStyle(element)["width"]is a potential option.