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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
<!DOCTYPE HTML>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
<meta charset="utf-8">
<title>Reference: Testing 'auto' min-sizing with percentage sizes</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1176775">
<style type="text/css">
body,html { color:black; background:white; font-size:10px; padding:0; margin:0; }
.wrap {
float: left;
}
.grid {
display: grid;
float: left;
grid-template-columns: minmax(0,0) 1fr;
grid-auto-rows: 10px;
border: 1px solid;
}
.item {
grid-row: 1 / 2;
grid-column: 1 / 2;
background:lime;
min-height:10px;
}
.item2 {
grid-row: 2 / 3;
grid-column: 1 / 2;
min-width:0;
min-height:10px;
justify-self:stretch;
background:grey;
}
br { clear:both; }
#px-border .item { border-left:20px solid blue; }
#percent-border .item { padding-left:10%; }
#px-border .grid { grid-template-columns: minmax(20px,0) 1fr; }
.c100 { grid-template-columns: minmax(100px,0) 1fr; }
.c100100 { grid-template-columns: minmax(100px,0) 100px; }
.c200 { grid-template-columns: 200px; }
#px-border .c100 { grid-template-columns: minmax(120px,0) 1fr; }
#px-border .c100calc100 { grid-template-columns: minmax(120px,0) 1fr; }
#px-border .c100100 { grid-template-columns: minmax(120px,0) 120px; }
#px-border .c200 { grid-template-columns: 240px; }
.c10 { grid-template-columns: minmax(10px,0) 1fr; }
#px-border .c10 { grid-template-columns: minmax(30px,0) 1fr; }
#percent-border .c100 { grid-template-columns: 100px 0; }
#percent-border .c100calc100 { grid-template-columns: 100px 10px; }
#percent-border .c10 { grid-template-columns: minmax(10px,0) 0; }
#percent-border .c100100 { grid-template-columns: minmax(100px,0) 150px; }
#percent-border .c200 { grid-template-columns: 250px; }
</style>
</head>
<body>
<table border="1">
<tr><th>no border/padding/margin</th><th>'border-left:20px'</th><th>'padding-left:10%'</th>
<tr><td id="no-border"></td><td id="px-border"></td><td id="percent-border"></td>
</tr></table>
<script>
var styles = [
"width:50%",
"width:50%; max-width:1px",
"width:50%; min-width:100px",
"width:calc(100px)",
"width:calc(100px + 50%)",
"width:100px; padding-right:50%",
"width:calc(100px + 50%); min-width:10px",
"width:calc(10px + 50%); min-width:100px",
"width:calc(75px + 50%); min-width:100px",
"width:calc(100px + 50%); max-width:1px",
"width:calc(100px + 50%); max-width:150px",
"min-width:50%",
"min-width:50%; max-width:1px",
"min-width:50%; width:100px",
"min-width:calc(100px)",
"min-width:calc(100px + 50%)",
"min-width:100px; padding-right:50%",
"min-width:calc(100px + 50%); width:10px",
"min-width:calc(10px + 50%); width:100px",
"min-width:calc(75px + 50%); width:100px",
"min-width:calc(100px + 50%); max-width:1px",
"min-width:calc(100px + 50%); max-width:150px",
];
var grids = [
"grid",
"grid",
"grid c100",
"grid c100",
"grid",
"grid c100",
"grid c10",
"grid c100",
"grid c100",
"grid",
"grid",
"grid",
"grid",
"grid c100",
"grid c100",
"grid",
"grid c100",
"grid c10",
"grid c100",
"grid c100",
"grid",
"grid",
];
var containers = [ "no-border", "px-border", "percent-border" ];
for (var i = 0; i < containers.length; ++i) {
var c = document.querySelector("#"+containers[i]);
for (var j = 0; j < styles.length; ++j) {
c.appendChild(document.createElement('br'));
c.appendChild(document.createTextNode(styles[j]));
c.appendChild(document.createElement('br'));
var item = document.createElement('div');
item.setAttribute("class","item");
item.setAttribute("style", styles[j]);
var item2 = document.createElement('div');
item2.setAttribute("class","item2");
var grid = document.createElement('div');
grid.setAttribute("class",grids[j]);
grid.appendChild(item);
grid.appendChild(item2);
var wrap = document.createElement('div');
wrap.setAttribute("class","wrap");
wrap.appendChild(grid);
c.appendChild(wrap);
}
}
</script>
</body>
</html>
|