The size (width and height) of a canvas can be changed, but the style size of the canvas can not be changed dynamically.
canvas = document.getElementById('test_fabric');
ctx = this.canvas.getContext('2d');
canvas.style.width = 1000; // does not work.
canvas.style.height = 260; // does not work.
canvas.width = 100; // works.
canvas.height = 100; // works.
Both canvas.width and canvas.height work well, but both canvas.style.width and canvas.style.height do not work.
In my case, the style size of the canvas only can be changed by a css file or inline style of the canvas.
<div><canvas id="test_fabric" width="200" height="200"
Note: The css file becomes ineffective when the inline style exists.
Thanks in advance!