-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjava4.html
More file actions
67 lines (67 loc) · 1.93 KB
/
java4.html
File metadata and controls
67 lines (67 loc) · 1.93 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Java4</title>
<style>
body {
background: lavender;
}
* {
text-align: center;
}
button {
width: 120px;
height: 50px;
background: beige;
border: 2px solid #a99cbd;
border-radius: 10px;
margin: 10px;
font-family: 나눔스퀘어;
}
#result {
width: 600px;
height: 400px;
border: 5px solid #a99cbd;
border-radius: 20px;
margin: 20px auto;
transition: all 1s ease-in;
animation: chimg 3s infinite ease-in-out alternate;
text-emphasis: center;
}
@keyframes chimg {
form {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 0;
}
}
</style>
</head>
<body>
<button onclick="ch_color('#B2CCFF')">BLUE</button>
<button onclick="ch_color('#FFC19E')">ORANGE</button>
<button onclick="ch_color('#D6FFD0')">GREEN</button>
<button onclick="ch_img('a2.jpg')">HOUSE</button>
<button onclick="ch_img('a1.jpg')">SKY</button>
<div id="result"></div>
<script>
function ch_color(color1) {
//var result1=document.querySelector('#result')
//var result1=document.getElementById('#result')
result.style.background=color1
}
function ch_img(image1) {
result.style.background="url('" + image1 + "')";
result.style.backgroundRepeat="no-repeat";
result.style.backgroundSize="cover"; /* contain이랑 비교해보기 */
}
</script>
</body>
</html>