HTML5 canvas之一:canvas element

<!DOCTYPE HTML>
<html>
  <head>
    <style>
      body {
        margin: 0px;
        padding: 0px;
      }
    </style>
  </head> 
  <body>
    <canvas id="myCanvas" width="578" height="200"></canvas>
    <script>
      var canvas = document.getElementById('myCanvas');
      var context = canvas.getContext('2d');

      // do cool things with the context
      context.font = '40pt Calibri';
      context.fillStyle = 'blue';
      context.fillText('Hello World!', 150, 100);
    </script>
  </body>
</html>  

HTML5

 

posted @ 2016-01-11 18:02  PeterFan  阅读(592)  评论(0编辑  收藏  举报