html
html
1
2
3
4
5
6
7
8
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
</body>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
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
* {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
}
.box {
display: inline-block;
margin: 0;
padding: 0;
width: 10vw;
height: 10vw;
border: 1px solid gray;
vertical-align: -10px;
}
body {
background-image: url(https://www.sololearn.com/avatars/4a75d57e-299b-4327-88da-a30596cb3405.jpg);
background-repeat: no-repeat;
background-size: 5% auto;
background-position: 98% 95vh;
}
Enter to Rename, Shift+Enter to Preview
js
js
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
function createBox() {
var div = document.createElement("div");
div.classList.add("box");
document.body.appendChild(div);
}
function init() {
var totalBoxes = 140;
var i;
for(i=0;i<totalBoxes;i++)
createBox();
var boxes = document.getElementsByClassName("box");
for(i=0;i<totalBoxes;i++) {
boxes[i].addEventListener("click", changeBackgroundColor.bind(boxes[i]), false);
}
}
function changeBackgroundColor() {
this.style.backgroundColor = "red";
}
onload = init;
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run