回到首页
个人中心
反馈问题
注册登录
下载APP
代码
提交代码
<!DOCTYPE html> <html> <head> <title>A Simple Canvas Example</title> <style> body{ background: #dddddd; } #canvas{ margin: 10px; padding: 10px; background: #ffffff; border: thin inset #aaaaaa; } </style> </head> <body> <canvas id="canvas" width="600" height="600"> Canvas not supported </canvas> <script> var canvas=document.getElementById('canvas'), context=canvas.getContext('2d'); context.font='38pt Arial'; context.fillStyle='cornflowerblue'; context.strokeStyle='blue'; context.fillText('Hello imooc',canvas.width/2-150,canvas.height/2+15); context.strokeText('Hello imooc',canvas.width/2-150,canvas.height/2+15); </script> </body> </html>
运行结果