หากผืนผ้าใบดูบิดเบี้ยว ให้ลองเปลี่ยนความสูงและความกว้าง -
<canvas id = ”canvas1” width = '400' height = '300'></canvas>
ความสูงและความกว้างเริ่มต้นของผืนผ้าใบใน HTML5 คืออัตราส่วน 2/1 -
width = 300 height = 150
ตัวอย่าง
เรามาดูตัวอย่างกัน −
<!DOCTYPE HTML>
<html>
<head>
<style>
#mycanvas{border:1px solid red;}
</style>
</head>
<body>
<canvas id = "mycanvas" width = "100" height = "100"></canvas>
</body>
</html> ผลลัพธ์
