I'm trying to get the two height values for this canvas.
<canvas width="886" height="792" style="display: block; opacity: 0.5; width: 834px; height: 746px;"></canvas>
I know, I can access one of the styles using canvas.style.height;
, but how do I get the other one?
please help. kind regards.
P粉3602660952024-04-06 00:07:45
You can get other heights simply by accessing the height property of the canvas:
var canvas = document.querySelector("canvas"); var height = canvas.height; console.log(height);