-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreate a Solar System.html
65 lines (53 loc) · 1.6 KB
/
Create a Solar System.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Challenge: Create a solar system</title>
<style>
body {
background-color: black;
padding: 10px;
}
.planet {
width: 100px;
height: 100px;
border-radius: 50%;
text-align: center;
padding: 10px;
position: relative;
}
.moon {
position: absolute;
width: 30px;
height: 30px;
border-radius: 50%;
background: rgb(237, 237, 237);
}
</style>
</head>
<body>
<script>
var divEl = document.createElement("div");
divEl.textContent = "Earth";
divEl.className = "planet"
divEl.style.backgroundColor = "#636CA4";
document.body.appendChild(divEl);
var moonEl = document.createElement("div");
moonEl.className = "moon"
document.body.appendChild(moonEl);
var divEl = document.createElement("div");
divEl.textContent = "Mercury";
divEl.className = "planet"
divEl.style.backgroundColor = "#DACDBE";
document.body.appendChild(divEl);
var divEl = document.createElement("div");
divEl.textContent = "Mars";
divEl.className = "planet";
divEl.style.backgroundColor = "red";
document.body.appendChild(divEl);
var moonEl = document.createElement("div");
moonEl.className = "moon";
document.body.appendChild(moonEl);
</script>
</body>
</html>