我有2个画布,一个使用HTML属性width
和height
大小它,另一个使用CSS:帆布使用CSS但正常为“宽度” /“高度”属性时拉伸
<canvas id="compteur1" width="300" height="300" onmousedown="compteurClick(this.id);"></canvas>
<canvas id="compteur2" style="width: 300px; height: 300px;" onmousedown="compteurClick(this.id);"></canvas>
Compteur1显示器像它应该,但不compteur2。内容在300x300画布上使用JavaScript绘制。
为什么会有显示差异?
的确..我一直以为像“宽度”和“高度”被抛弃了直接的属性在最近的html版本中.. – Sirber 2010-04-09 00:02:03
哦,显然它在http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#attr-canvas-宽度(section#'attr-canvas-width')。麻烦的是,我之前点击了错误的'width',而是转到了'#dom-canvas-width'部分。归档http://www.w3.org/Bugs/Public/show_bug.cgi?id=9469。 – SamB 2010-04-09 16:27:11
你救了我一个可怕的头痛....谢谢! – nurxyz 2013-07-18 10:51:32