This repository was archived by the owner on Jul 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathtask9.html
91 lines (90 loc) · 2.32 KB
/
task9.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html>
<head>
<title>Task 9</title>
<style>
body {
font-family: Arial;
background-color: pink;
margin: 0;
padding: 20px;
}
.profile {
max-width: 400px;
margin: 0 auto;
background-color: wheat;
padding: 20px;
border-radius: 5px;
box-shadow: 0 2px 5px black;
}
.avatar {
width: 100px;
height: 100px;
border-radius: 50%;
object-fit:contain;
margin-bottom: 10px;
}
.name {
font-size: 20px;
font-weight: bold;
margin-bottom: 10px;
}
.bio {
font-style: italic;
margin-bottom: 15px;
}
.detail {
margin-bottom: 10px;
}
.label {
font-weight: bold;
}
</style>
</head>
<body>
<div class="profile">
<img class="avatar" id="avatar" alt="Avatar">
<h1 class="name" id="name"></h1>
<p class="bio" id="bio"></p>
<div class="detail">
<span class="label">Age:</span>
<span id="age"></span>
</div>
<div class="detail">
<span class="label">Gender:</span>
<span id="gender"></span>
</div>
<div class="detail">
<span class="label">Email:</span>
<span id="email"></span>
</div>
<div class="detail">
<span class="label">Location:</span>
<span id="location"></span>
</div>
<div class="detail">
<span class="label">Occupation:</span>
<span id="occupation"></span>
</div>
<div class="detail">
<span class="label">Hobbies:</span>
<span id="hobbies"></span>
</div>
</div>
<script>
fetch('https://cc-bhu.github.io/web-development/assets/api/person.json')
.then(response => response.json())
.then(data => {
document.getElementById("avatar").src = data.avatar;
document.getElementById("name").innerHTML = data.name;
document.getElementById("bio").innerHTML = data.bio;
document.getElementById("age").innerHTML = data.age;
document.getElementById("gender").innerHTML = data.gender;
document.getElementById("email").innerHTML = data.email;
document.getElementById("location").innerHTML = data.location;
document.getElementById("occupation").innerHTML = data.occupation;
document.getElementById("hobbies").innerHTML = data.hobbies;
});
</script>
</body>
</html>