-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path8-1.html
48 lines (34 loc) · 850 Bytes
/
8-1.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
45
46
47
48
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>8-1</title>
<base href="./images/" target="_blank">
<style>
:root{
--main-bg-color:white;
}
div#div1{
width:calc( 100% - 100px );
height: 100%;
margin:0 auto;
background: var(--main-bg-color);
}
</style>
</head>
<body>
<div id="div1">
<img id="img1" src="1122.jpg" alt="1122.jpg" width="300px" />
<canvas id="can1" width="400px" height="400px" style="background: white;border:1px solid black;">
</canvas>
</div>
<script>
var c = document.getElementById('can1');
var ctx=c.getContext("2d");
var img=document.getElementById("img1");
img.onload=function(){
ctx.drawImage(img,10,10,300,500);
}
</script>
</body>
</html>