-
Notifications
You must be signed in to change notification settings - Fork 0
/
DOMPractice.html
49 lines (35 loc) · 1.03 KB
/
DOMPractice.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
<!DOCTYPE html>
<html lang='en'>
<meta charset="utf-8"/>
<body>
<h1>
THE TITLE OF YOUR WEBPAGE
</h1>
<div id="container"></div>
</body>
<script>
const container = document.querySelector('#container');
const content = document.createElement('div');
content.classList.add('content');
content.textContent = 'This is the glorious text-content!';
container.appendChild(content);
const p = document.createElement('p');
p.style.color ='red';
p.textContent ="Hey I'm red!";
container.appendChild(p);
const h3 = document.createElement('h3');
h3.style.color = 'blue';
h3.textContent = "I'm a blue h3";
container.appendChild(h3);
const hTest = document.createElement('hTest');
const p1 = document.createElement('p1');
p1.textContent = "ME TOO!";
hTest.textContent = "I'm in a div! ";
const div2 = document.createElement('div2');
//Need to add black border
div2.setAttribute("style", 'background: pink;');
div2.append(hTest);
div2.append(p1);
container.appendChild(div2);
</script>
</html>