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
106 lines (97 loc) · 3.07 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>User Profile</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
margin: 0;
padding: 20px;
}
.profile {
max-width: 400px;
margin: 0 auto;
background-color: #ffffff;
border-radius: 8px;
padding: 20px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.avatar {
width: 100px;
height: 100px;
border-radius: 50%;
margin-bottom: 10px;
}
.name {
font-size: 24px;
font-weight: bold;
margin-bottom: 5px;
}
.bio {
font-size: 16px;
color: #666666;
margin-bottom: 20px;
}
.detail {
margin-bottom: 10px;
}
.detail label {
font-weight: bold;
}
.detail span {
margin-left: 5px;
}
</style>
</head>
<body>
<div class="profile">
<img class="avatar" src="" alt="Avatar">
<div class="name"></div>
<div class="bio"></div>
<div class="detail">
<label>Age:</label>
<span class="age"></span>
</div>
<div class="detail">
<label>Gender:</label>
<span class="gender"></span>
</div>
<div class="detail">
<label>Email:</label>
<span class="email"></span>
</div>
<div class="detail">
<label>Location:</label>
<span class="location"></span>
</div>
<div class="detail">
<label>Occupation:</label>
<span class="occupation"></span>
</div>
<div class="detail">
<label>Hobbies:</label>
<span class="hobbies"></span>
</div>
</div>
<script>
fetch('https://cc-bhu.github.io/web-development/assets/api/person.json')
.then(response => response.json())
.then(data => {
document.querySelector('.avatar').src = data.avatar;
document.querySelector('.name').textContent = data.name;
document.querySelector('.bio').textContent = data.bio;
document.querySelector('.age').textContent = data.age;
document.querySelector('.gender').textContent = data.gender;
document.querySelector('.email').textContent = data.email;
document.querySelector('.location').textContent = data.location;
document.querySelector('.occupation').textContent = data.occupation;
document.querySelector('.hobbies').textContent = data.hobbies.join(', ');
})
.catch(error => {
console.log('Error:', error);
});
</script>
</body>
</html>