tenfourfox/layout/reftests/css-grid/grid-auto-min-sizing-percent-001.html
Cameron Kaiser c9b2922b70 hello FPR
2017-04-19 00:56:45 -07:00

110 lines
3.0 KiB
HTML

<!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>