I am trying to place two canvas nearby. But unfortunately when i include two canvas it automatically produces a space between two canvas. How to remove that empty space or how to join that two canvas. Here is my fiddle Fiddle
here is my code:
<canvas id="button" width="30" height="30" style="border:1px solid #d3d3d3;background-color:green;"></canvas>
<canvas id="button" width="30" height="30" style="border:1px solid #d3d3d3;background-color:green;"></canvas>
here is the script:
window.onload=function()
{
var canvas = document.getElementById("button");
var ctx = canvas.getContext('2d');
}
I am trying to place two canvas nearby. But unfortunately when i include two canvas it automatically produces a space between two canvas. How to remove that empty space or how to join that two canvas. Here is my fiddle Fiddle
here is my code:
<canvas id="button" width="30" height="30" style="border:1px solid #d3d3d3;background-color:green;"></canvas>
<canvas id="button" width="30" height="30" style="border:1px solid #d3d3d3;background-color:green;"></canvas>
here is the script:
window.onload=function()
{
var canvas = document.getElementById("button");
var ctx = canvas.getContext('2d');
}
Share
Improve this question
asked Dec 19, 2012 at 3:55
Praveen SinghPraveen Singh
5422 gold badges10 silver badges23 bronze badges
1 Answer
Reset to default 8The newline in the HTML is being treated as a space. Simply get rid of the whitespace between the two canvases:
<canvas id="button" width="30" height="30" style="border:1px solid #d3d3d3;background-color:green;">
</canvas><canvas id="button" width="30" height="30" style="border:1px solid #d3d3d3;background-color:green;">
</canvas>
See fiddle.
Or use:
<canvas id="button" width="30" height="30" style="border:1px solid #d3d3d3;background-color:green;"></canvas><!--
--><canvas id="button" width="30" height="30" style="border:1px solid #d3d3d3;background-color:green;"></canvas>
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745290004a4620799.html
评论列表(0条)