<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
canvas{background: #b8edc9;}
</style>
</head>
<body>
<h5>Canvas</h5>
<canvas id="mycanvas" width="1000" height="1000">
您的浏览器不支持html5dcanvas元素
</canvas>
<script type="text/javascript">
var canvas=document.getElementById('mycanvas');//定义变量获取画布dom
var c=mycanvas.getContext('2d');//设置绘图环境2d
//绘制文字
c.lineWidth=1;
c.strokeStyle="fuchsia";
c.fillStyle="blue";
c.font="40px 隶书"//设置字体格式font="大小 字体"
c.strokeText("帅",344,390);//设置空心字体
c.fillText("帅",344,450);//设置实心字体
c.strokeText("帅",50,520);//设置有边的实心字体
c.fillText("帅",50,520);
</script>
</body>
</html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
canvas{background: #b8edc9;}
</style>
</head>
<body>
<h5>Canvas</h5>
<canvas id="mycanvas" width="1000" height="1000">
您的浏览器不支持html5dcanvas元素
</canvas>
<script type="text/javascript">
var canvas=document.getElementById('mycanvas');//定义变量获取画布dom
var c=mycanvas.getContext('2d');//设置绘图环境2d
//绘制文字
c.lineWidth=1;
c.strokeStyle="fuchsia";
c.fillStyle="blue";
c.font="40px 隶书"//设置字体格式font="大小 字体"
c.strokeText("帅",344,390);//设置空心字体
c.fillText("帅",344,450);//设置实心字体
c.strokeText("帅",50,520);//设置有边的实心字体
c.fillText("帅",50,520);
</script>
</body>
</html>