I have an element with 80.5px width
in javascript i have a script that checks whats the elements width is
document.getElementById("..").clientWidth
but that returns 80 and not 80.5 is there a way to fix that?
I have an element with 80.5px width
in javascript i have a script that checks whats the elements width is
document.getElementById("..").clientWidth
but that returns 80 and not 80.5 is there a way to fix that?
You can achieve by using Element.getBoundingClientRect().width
let box = document.getElementById('box');
let width = box.getBoundingClientRect().width;
console.log(width);
#box { width:80.5px; }
<div id="box">
</div>