我将边距,填充和边框设置为零,但我的画布和div周围仍有空间用于Firefox和Chrome.很明显,我不明白如何在
HTML中使用元素,并且会感激建议&指针.
Spacing Question*
{
border: 0px;
margin: 0px;
padding: 0px;
}
canvas
{
width: 150px;
height: 150px;
}
body
{
background-color: Purple;
color: Silver;
}
function draw() {
var canvas = document.getElementById('canvas1');
if (canvas.getContext) {
var ctx = canvas.getContext('2d');
ctx.fillStyle = "rgb(200, 0, 0)";
ctx.fillRect(0, 0, 150, 150);
}
canvas = document.getElementById('canvas2');
if (canvas.getContext) {
var ctx = canvas.getContext('2d');
ctx.fillStyle = "rgb(0, 200, 0)";
ctx.fillRect(0, 0, 150, 150);
}
}
Fallback content 1.
Fallback content 2.