forked from lemontizz/convas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
44 lines (38 loc) · 1.12 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
#canvas2 {
width: 600px;
height: 300px;
}
</style>
</head>
<body>
<h1>canvas</h1>
<canvas style="border: 1px solid red;" id="canvas" width='600' height='300'>
Canvas not supported
</canvas>
<canvas style="border: 1px solid red;" id="canvas2">
Canvas not supported
</canvas>
<script>
var canvas = document.getElementById('canvas'),
context = canvas.getContext('2d');
context.font = '38pt Arial';
context.fillStyle = 'yellow';
context.strokeStyle = 'blue';
context.fillText('Hello Canvas', canvas.width / 2 - 150, canvas.height / 2 + 15);
context.strokeText('Hello Canvas', canvas.width / 2 - 150, canvas.height / 2 + 15);
var canvas2 = document.getElementById('canvas2'),
context = canvas2.getContext('2d');
context.font = '38pt Arial';
context.fillStyle = 'yellow';
context.strokeStyle = 'blue';
context.fillText('Hello canvas2', canvas2.width / 2 - 150, canvas2.height / 2 + 15);
context.strokeText('Hello canvas2', canvas2.width / 2 - 150, canvas2.height / 2 + 15);
</script>
</body>
</html>