<canvas></canvas>标签是一个类似于块的标签,这个标签,默认是没有边框和内容的,类似于div

如:

<!DOCTYPE html>  

<html>
<head>
<title></title>

</head>
<body>
<canvas id="myCanvas" width="200" height="100" >
Your browser does not support the HTML5 canvas tag.
</canvas>
<script>
var c=document.getElementById("myCanvas");

var ctx=c.getContext("2d");
console.log(ctx);
ctx.fillStyle="#FF0000";
ctx.fillRect(0,0,150,75);
</script>
</body>

</html>

 

上面是一个简单的例子

当我样想要得到这个对象时,就要用