-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpt1.html
More file actions
43 lines (37 loc) · 880 Bytes
/
pt1.html
File metadata and controls
43 lines (37 loc) · 880 Bytes
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
<!DOCTYPE html>
<html>
<head>
<style>
*{
padding: 0;
margin: 0;
}
body{
background-color: azure;
}
canvas{
background-color: pink;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
}
</style>
</head>
<body>
<canvas width="400" height="400"></canvas>
</body>
<script type="text/javascript">
window.onload=function(){
var canvas = document.querySelector("canvas");
//取得筆
if(canvas.getContext){
var ctx = canvas.getContext("2d");
ctx.fillStyle = "deeppink";
ctx.fillRect(0,0,100,100);
}
}
</script>
</html>