Advertisement
Guest User

canvas background demo

a guest
Jul 10th, 2011
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.61 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>Canvas demo</title>
  5. <style type="text/css">
  6.     #canvasSection{
  7.       position:fixed;
  8.       top:0;
  9.       left:0;
  10.      }
  11. </style>
  12. <script type="text/javascript">
  13. function draw()
  14. {
  15. var canvas = document.getElementById('canvasSection');
  16. var ctxSquare = canvas.getContext('2d');
  17. ctxSquare.fillStyle='#999999';
  18. ctxSquare.fillRect(0, 0,30,30);
  19. }
  20. </script>
  21. </head>
  22. <body onLoad="draw()">
  23. <canvas id="canvasSection">Error, canvas is not supported</canvas>
  24. <div style="z-index:1">TestText</div>
  25. </body>
  26. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement