Home > Net >  Get the *two* height values of an canvas?
Get the *two* height values of an canvas?

Time:12-18

I am trying to get the two height values of this canvas.

<canvas width="886" height="792" style="display: block; opacity: 0.5; width: 834px; height: 746px;"></canvas>

I know, that I can access the one in the style by using canvas.style.height; but how do I get the other one?

Please help. Kind regards.

CodePudding user response:

You can obtain the other height by simply accessing the canvas's height property:

var canvas = document.querySelector("canvas");
var height = canvas.height;
console.log(height);
  • Related