forked from myeong/INST377
-
Notifications
You must be signed in to change notification settings - Fork 125
/
Copy pathattribute.html
executable file
·51 lines (40 loc) · 1.1 KB
/
attribute.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
<!-- This file is for changing CSS attributes using JavaScript -->
<html>
<head>
<style type="text/css">
#square {
margin-top: 20px;
margin-left: 100px;
height: 200px;
width: 200px;
background: blue;
}
div {
margin-bottom: 20px;
}
.round {
border-radius: 20px;
}
</style>
</head>
<body>
<div id="square" style="background:black"></div>
<div>
<p> Hello, this is inside a PPPPP tag. </p>
</div>
<script>
var t = document.getElementsByTagName('p')[0]
console.log(t)
document.getElementById('square').appendChild(t)
// document.getElementById("square").setAttribute("style", "");
// document.getElementById("square").setAttribute("style", "background:red");
// document.getElementById("square").style.border = "4px solid";
// document.getElementById("square").style.borderColor = "orange";
// document.getElementById("square").setAttribute("class", "round");
/*
Try to move the sentence inside the sentence inside the P tag so it is overlapping with the square. Change the color of the sentence so it is visible inside the box.
Your code goes below.
*/
</script>
</body>
</html>