HTML5 Canvas 扭曲
htmljavascriptprogramming scripts
如果 Canvas 看起来扭曲了,请尝试更改高度和宽度 −
<canvas id = ”canvas1” width = '400' height = '300'></canvas>
HTML5 中 Canvas 的默认高度和宽度比例为 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>