标签: css html5-canvas
我将边界和边距设置为零。
<div class='nobordermargin'>hello</div> <canvas class='nobordermargin' id="myCanvas" width="300" height="150"></canvas> <div class='nobordermargin'>hello</div>
The jsbin demo
答案 0 :(得分:2)
您只需要将canvas设置为{ display: block; },因为默认为inline。
canvas
{ display: block; }
inline
JSBin Snapshot
也请参见此处:Inline Elements | MDN