Get the *two* height values ​​of the canvas?
P粉604848588
P粉604848588 2024-04-05 09:32:33
0
1
1434

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粉604848588
P粉604848588

reply all(1)
P粉360266095

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);
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template