-
Notifications
You must be signed in to change notification settings - Fork 0
/
index3.html
68 lines (57 loc) · 1.74 KB
/
index3.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Challenge: Custom name tags</title>
<style>
* {
box-sizing: border-box;
}
.name-tag {
border: 1px solid red;
border-radius: 6px;
width: 300px;
height: 150px;
margin-bottom: 10px;
background: red;
font-family: sans-serif;
}
.name-tag h1 {
color: white;
text-align: center;
height: 25px;
margin: 5px 0px 0px 0px;
font-size: 20px;
}
.name-tag p {
position: relative;
left: 5px;
padding: 10px;
width: 290px;
height: 90px;
background: white;
font-family: cursive;
font-size: 20px;
text-align: center;
}
</style>
</head>
<body>
<div class="name-tag">
<h1>Hello, my name is...</h1>
<p>Grace Hopper</p>
</div>
<div class="name-tag">
<h1>Hello, my name is...</h1>
<p>Alan Turing</p>
</div>
<script>
var nameCls = document.getElementsByTagName("h1");
console.log(nameCls);
console.log(nameCls[0]);
for (var i =0; i < nameCls.length; i++) {
nameCls [i].innerHTML = "Hello, world";
}
</script>
</body>
</html>