Source code

Revision control

Copy as Markdown

Other Tools

<!DOCTYPE HTML>
<!--
Any copyright is dedicated to the Public Domain.
-->
<html><head>
<meta charset="utf-8">
<title>CSS Grid Test: repeat(auto-fit) with grid-aligned abs.pos. with removed start/middle tracks and implicit tracks on either/both sides</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1239036">
<style type="text/css">
html,body {
color:black; background-color:white; font-size:16px; padding:0; margin:0;
}
.grid {
display: grid;
position: relative;
border: 1px solid;
grid-auto-rows: 30px;
grid-auto-columns: 3px;
grid-template-columns: [a] repeat(auto-fit, [b] 20px [c]) [d] 20px;
height: 30px;
}
.c1 { width: 165px; }
.c2 { width: 155px; }
.c3 { width: 150px; }
.p1 { padding-left:5px; }
.t2 { grid-template-columns: [a] repeat(auto-fit, [b] 20px [c]) [d]; }
x {
width: 18px;
border:1px solid;
background: grey;
}
a {
position: absolute;
top:0; height:3px; right:0;
background: cyan;
grid-column: auto / auto;
}
b {
position: absolute;
left:0; bottom:0; height:3px; width:103px;
background: brown;
grid-column: auto / auto;
}
.c2 b {width:100px;}
c {
position: absolute;
left:0; bottom:5px; height:3px; right:0;
background: pink;
grid-column: auto / auto;
}
d {
position: absolute;
left:23px; bottom:10px; height:3px; width:60px;
background: silver;
grid-column: auto / auto;
}
e {
position: absolute;
left:0; bottom:15px; height:3px; right:0;
background: magenta;
grid-column: auto / auto;
}
f {
position: absolute;
left:0; bottom:20px; height:3px; width:83px;
background: orange;
grid-column: auto / auto;
}
.c2 f {width:80px;}
x:first-of-type {
background: lime;
}
x:nth-of-type(1) { grid-area:1/1; }
x:nth-of-type(2) { grid-area:1/2; }
x:nth-of-type(3) { grid-area:1/3; }
x:nth-of-type(4) { grid-area:1/4; }
x:nth-of-type(5) { grid-area:1/5; }
x:last-of-type {
background: blue;
}
.t1 x:last-of-type {
grid-column-end:-1;
}
float { float:left; margin-right:20px; }
.m x:first-of-type , .n x:first-of-type {
background: cyan;
grid-area:1/2;
}
.n x:nth-of-type(2) , .o x:nth-of-type(2) {
background: purple;
grid-area:1/4;
}
.c1 y, .c3 y:first-of-type { grid-column: span X / 1; background:black; }
.c2 y, .c3 y:last-of-type { grid-column: -1 / span X; background:black; }
.s2 { left: 23px; }
.s2a { left: 20px; }
.e5 { right: 82px; }
.e5a { right: 75px; }
.e5b { right: 67px; }
.e6 { right: 62px; }
.e6a { right: 55px; }
.e6b { right: 47px; }
.c2 d { left:20px; }
.t2.x4 f, .t2.x3 f { width:63px; }
.c2.t2.x4 f, .c2.t2.x3 f { width:60px; }
.t2.x4 d, .t2.x3 d { width:40px; }
.x2 d { width:20px; }
.x2 f { width:43px; }
.c2.x2 f { width:40px; }
.t2.x5 b { width:83px; }
.c2.t2.x5 b { width:80px; }
.t2.x4 b, .t2.x3 b { width:63px; }
.c2.t2.x4 b, .c2.t2.x3 b { width:60px; }
.x2 b { width:43px; }
.c2.x2 b { width:40px; }
.t1.x5 c, .t1.x4 c, .t1.x3 c { left:83px; width:20px; right:auto; }
.c2.x5 c , .c2.t1.x4 c , .c2.t1.x3 c { left:80px; }
.t2.x5 c { left:83px; }
.c2.t2.x5 c { left:80px; }
.t2.x4 c , .t2.x3 c { left:63px; }
.c2.t2.x4 c , .c2.t2.x3 c { left:60px; }
.t1.x2 c , .t2.x2 c { left:43px; }
.c2.t2.x2 c , .c2.t1.x2 c { left:40px;}
.x2 e { left:23px; width:20px; right:auto; }
.c2.x2 e { left:20px; }
.t1.c3.x2 e { width:20px; }
.t1.c3.x2 c { width:20px; right:auto;}
.t2.x5 e { left:23px; width:60px; }
.x4 e , .x3 e , .x2 e { left:23px; }
.c2.x4 e , .c2.x3 e , .c2.x2 e { left:20px; }
.c2.t2.x5 e { left:20px; }
.t1.x4 e , .t1.x3 e { width:80px; }
.t2.x4 e , .t2.x3 e { width:40px; }
</style>
</head>
<body>
<float>
<div class="grid c1 t1 n x5"><x></x><x></x><x></x><x></x><y></y><a style="width:62px"></a><b></b><c></c><d></d><e class="s2 e6"></e><f class="e5"></f><x></x></div>
<div class="grid c2 t1 n x5"><x></x><x></x><x></x><x></x><y></y><a style="width:55px"></a><b></b><c></c><d></d><e class="s2a e6a"></e><f class="e5a"></f><x></x></div>
<div class="grid c3 t1 n x5"><x></x><x></x><x></x><x></x><y></y><y></y><a style="width:47px"></a><b></b><c></c><d></d><e class="s2 e6b"></e><f class="e5b"></f><x></x></div>
<div class="grid c1 t2 m x5"><x></x><x></x><x></x><x></x><y></y><a style="width:82px"></a><b></b><d></d><e class="s2"></e><f class="e5"></f><x></x></div>
<div class="grid c2 t2 m x5"><x></x><x></x><x></x><x></x><y></y><a style="width:75px"></a><b></b><d></d><e class="s2e"></e><f class="e5"></f><x></x></div>
<div class="grid c3 t2 m x5"><x></x><x></x><x></x><x></x><y></y><y></y><a style="width:67px"></a><b></b><d></d><e></e><f class="e5"></f><x></x></div>
<div class="grid c1 t1 o x4"><x></x><x></x><x></x><y></y><a style="width:62px"></a><b></b><c></c><d></d><e></e><f class="e5"></f><x></x></div>
<div class="grid c2 t1 o x4"><x></x><x></x><x></x><y></y><a style="width:55px"></a><b></b><c></c><d></d><e></e><f></f><x></x></div>
<div class="grid c3 t1 o x4"><x></x><x></x><x></x><y></y><y></y><a style="width:47px"></a><b></b><c></c><d></d><e></e><f></f><x></x></div>
<div class="grid c1 t2 o x4"><x></x><x></x><x></x><y></y><a style="width:102px"></a><b></b><d></d><e></e><f class="e5"></f><x></x></div>
<div class="grid c2 t2 o x4"><x></x><x></x><x></x><y></y><a style="width:95px"></a><b></b><d></d><e></e><f></f><x></x></div>
<div class="grid c3 t2 o x4"><x></x><x></x><x></x><y></y><y></y><a style="width:87px"></a><b></b><d></d><e></e><f></f><x></x></div>
<div class="grid c1 t1 n x3"><x></x><x></x><y></y><a style="width:62px"></a><b></b><c></c><d></d><e></e><f class="e5"></f><x></x></div>
<div class="grid c2 t1 n x3"><x></x><x></x><y></y><a style="width:55px"></a><b></b><c></c><d></d><e></e><f></f><x></x></div>
<div class="grid c3 t1 n x3"><x></x><x></x><y></y><y></y><a style="width:47px"></a><b></b><c></c><d></d><e></e><f></f><x></x></div>
<div class="grid c1 t2 n x3"><x></x><x></x><y></y><a style="width:102px"></a><b></b><d></d><e></e><f class="e5"></f><x></x></div>
<div class="grid c2 t2 n x3"><x></x><x></x><y></y><a style="width:95px"></a><b></b><d></d><e></e><f class="e5"></f><x></x></div>
<div class="grid c3 t2 n x3"><x></x><x></x><y></y><y></y><a style="width:87px"></a><b></b><d></d><e></e><f></f><x></x></div>
</float>
<float>
<div class="grid c1 t1 n x2"><x></x><y></y><a style="width:122px"></a><b></b><d></d><e></e><f></f><x></x></div>
<div class="grid c2 t1 n x2"><x></x><y></y><a style="width:115px"></a><b></b><d></d><e></e><f></f><x></x></div>
<div class="grid c3 t1 n x2"><x></x><y></y><y></y><a style="width:107px"></a><b></b><d></d><e></e><f></f><x></x></div>
<div class="grid c1 t2 n x2"><x></x><y></y><a style="width:122px"></a><b></b><d></d><e></e><f></f><x></x></div>
<div class="grid c2 t2 n x2"><x></x><y></y><a style="width:115px"></a><b></b><d></d><e></e><f></f><x></x></div>
<div class="grid c3 t2 n x2"><x></x><y></y><y></y><a style="width:107px"></a><b></b><d></d><e></e><f></f><x></x></div>
</float>
</body>
</html>