-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy path072.Grid 布局练习.html
77 lines (64 loc) · 1.73 KB
/
072.Grid 布局练习.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
74
75
76
77
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./assets/global.css">
<style>
.grid {
display: grid;
grid-template-columns: 42% 25% 33%;
grid-template-rows: 285px 406px 320px 190px;
row-gap: 20px;
column-gap: 20px;
}
.grid>div {
background-color: #41f;
display: flex;
justify-content: center;
align-items: center;
font-size: 80px;
color: #fff;
}
.g3 {
grid-column: 3;
grid-row-start: 1;
grid-row-end: 3;
}
.g4 {
grid-row: 2;
grid-column-start: 1;
grid-column-end: 3;
}
.g6 {
grid-column: 2;
grid-row-start: 3;
grid-row-end: 5;
}
.g7 {
grid-column: 3;
grid-row-start: 3;
grid-row-end: 5;
}
</style>
</head>
<body>
<div class="grid">
<div class="g1">1</div>
<div class="g2">2</div>
<div class="g3">3</div>
<div class="g4">4</div>
<div class="g5">5</div>
<div class="g6">6</div>
<div class="g7">7</div>
<div class="g8">8</div>
</div>
<script type="module">
import { Randoms } from "https://gcore.jsdelivr.net/npm/@3r/tool/lib/randoms.js";
document.querySelectorAll('.grid > div').forEach(item => {
item.style.backgroundColor = Randoms.getRandomColor()
})
</script>
</body>
</html>