summaryrefslogtreecommitdiffstats
path: root/layout/reftests/css-grid/grid-auto-min-sizing-percent-001.html
blob: 6854ad71f2c7a7de7921928dfc06404896a16638 (plain)
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
<!DOCTYPE HTML>
<!--
     Any copyright is dedicated to the Public Domain.
     http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
  <meta charset="utf-8">
  <title>CSS Grid Test: Testing 'auto' min-sizing with percentage sizes</title>
  <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1176775">
  <link rel="help" href="https://drafts.csswg.org/css-grid/#min-size-auto">
  <link rel="match" href="grid-auto-min-sizing-percent-001-ref.html">
  <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(auto,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%; }

  </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 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","grid");
    grid.appendChild(item);
    grid.appendChild(item2);
    var wrap = document.createElement('div');
    wrap.setAttribute("class","wrap");
    wrap.appendChild(grid);
    c.appendChild(wrap);
  }
}
</script>



</body>
</html>