-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathcontent-position.html
120 lines (116 loc) · 4.92 KB
/
content-position.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<!DOCTYPE html>
<html>
<head>
<link href="css/grid.css" rel="stylesheet">
<style>
body {
margin: 0px;
}
.grid {
-ms-grid-template-columns: 50px 50px;
grid-template-columns: 50px 50px;
-ms-grid-template-rows: 100px 100px;
grid-template-rows: 100px 120px;
}
.containerGrid {
display: grid;
display: -ms-grid;
-ms-grid-template-areas: "c1 c2"
"c1 c3"
"c4 c4";
grid-template-areas: "c1 c2"
"c1 c3"
"c4 c4";
grid-auto-columns: auto;
grid-auto-rows: auto;
justify-content: space-between;
align-content: space-between;
width: 400px;
height: 350px;
}
.c1 {
-ms-grid-area: c1;
grid-area: c1;
}
.c2 {
-ms-grid-area: c2;
grid-area: c2;
}
.c3 {
-ms-grid-area: c3;
grid-area: c3;
}
.c4 {
-ms-grid-area: c4;
grid-area: c4;
}
.cell {
width: 20px;
height: 40px;
}
.overflowWidth {
width: 60px;
height: 300px;
}
.overflowHeight {
width: 200px;
height: 150px;
}
.noOverflow {
width: 200px;
height: 300px;
}
</style>
<script>
function change_justify_position(obj) {
var grid = document.getElementById("grid");
grid.style.justifyContent=obj.value;
}
function change_align_position(obj) {
var grid = document.getElementById("grid");
grid.style.alignContent=obj.value;
}
function change_dimensions(obj) {
var grid = document.getElementById("grid");
grid.classList.remove(grid.classList.item(1));
grid.classList.add(obj.value);
}
</script>
</head>
<body>
<div class="containerGrid">
<div class="container c1">
<div id="grid" class="grid noOverflow">
<div class="cell row1-column1"></div>
<div class="row2-column1"></div>
<div class="row1-column2"></div>
<div class="cell row2-column2"></div>
</div>
</div>
<div class="container c2">
<div><label><b>justify-content:</b></label></div>
<div><label><input type="radio" name="justify-content" onclick="change_justify_position(this)" value="start true">start end</label></div>
<div><label><input type="radio" name="justify-content" onclick="change_justify_position(this)" value="start safe">start safe</label></div>
<div><label><input type="radio" name="justify-content" onclick="change_justify_position(this)" value="center true">center true</label></div>
<div><label><input type="radio" name="justify-content" onclick="change_justify_position(this)" value="center safe">center safe</label></div>
<div><label><input type="radio" name="justify-content" onclick="change_justify_position(this)" value="end true">end true</label></div>
<div><label><input type="radio" name="justify-content" onclick="change_justify_position(this)" value="end safe">end safe</label></div>
</div>
<div class="container c3">
<div><label><b>align-content:</b></label></div>
<div><label><input type="radio" name="align-content" onclick="change_align_position(this)" value="start true">start true</label></div>
<div><label><input type="radio" name="align-content" onclick="change_align_position(this)" value="start safe">start safe</label></div>
<div><label><input type="radio" name="align-content" onclick="change_align_position(this)" value="center true">center true</label></div>
<div><label><input type="radio" name="align-content" onclick="change_align_position(this)" value="center safe">center safe</label></div>
<div><label><input type="radio" name="align-content" onclick="change_align_position(this)" value="end true">end true</label></div>
<div><label><input type="radio" name="align-content" onclick="change_align_position(this)" value="end safe">end safe</label></div>
</div>
<div class="container c4">
<div><label><b>Overflow:</b></label></div>
<label><input type="radio" name="dimensions" onclick="change_dimensions(this)" value="noOverflow">no overflow</label>
<label><input type="radio" name="dimensions" onclick="change_dimensions(this)" value="overflowWidth">overflow width</label>
<label><input type="radio" name="dimensions" onclick="change_dimensions(this)" value="overflowHeight">overflow height</label>
</div>
</div>
</body>
</html>