-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgenerator.html
73 lines (55 loc) · 1.63 KB
/
generator.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
<!doctype html>
<html>
<head>
<title>generator</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
margin: 0;
font-family: sans-serif;
background: #666;
}
.box {
width: 20%;
min-width: 3em;
margin: 0;
float: left;
color: white;
text-align: center;
line-height: 4;
}
.box:hover {
color: black;
}
@media screen and (min-width: 40em) {
.box {
width: 10%;
}
}
@media screen and (min-width: 70em) {
.box {
width: 5%;
}
}
</style>
</head>
<body>
<script>
var i;
for (i = 1; i < 361; i++) {
var hue = i;
var bg = "hsl("+hue+", 100%, 50%)";
// Méthode jQuery:
// var box = "<div class=box style='background-color:"+bg+"'>"+hue+"</div>";
// $("body").append(box);
// Methode Vanilla JavaScript:
var box = document.createElement('div');
box.className = "box";
box.style.backgroundColor = bg;
box.innerHTML = hue;
document.querySelector("body").appendChild(box);
}
</script>
</body>
</html>