I share this blog with my thoughts and creations from my daily programming, knowledge, and technology updates.
Tuesday, May 7, 2019
canvasのwidthとheightの設定
タグ内で設定したい
<canvas id="canvas1" width=600 height="1200"></canvas>
スクリプトで設定したい
var canvas_div = elem('canvas_div');
var canvas = document.getElementById('canvas1');
canvas.width = 600;
canvas.height = 1200;
補足:スタイルで設定してもうまくいかなかった
<style>
#canvas1 {
width: 600;
height1200;
}
</style>
参考
HTMLCanvasElement.width
https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/width
HTMLCanvasElement.height
Latest post
Extracting data from Google Sheets with regular expressions
Introduction Regular expressions are a powerful tool that can be used to extract data from text. In Google Sheets, regular expressions ca...