<!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
时间: 2024-10-14 07:45:46