<!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: Masonry layout with `justify-tracks:stretch`</title>
  <link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
  <link rel="help" href="https://drafts.csswg.org/css-grid-2">
  <link rel="match" href="masonry-justify-tracks-stretch-001-ref.html">
  <link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
<style>
html,body {
  color:black; background-color:white; font:16px/1 Ahem; padding:0; margin:0;
}
grid {
  display: inline-grid;
  grid-template-rows: 150px 100px 50px;
  grid-template-columns: masonry;
  justify-tracks: stretch;
  gap: 5px 3px;
  padding: 10px;
  border: 3px solid;
  background: lightgrey content-box;
  width: 500px;
}
item {
  background: grey;
  width: 3ch;
  position: relative;
}
item:nth-child(2n) { background:purple; width:auto; }
item:nth-child(1) { border:10px solid; margin: 10px 0 5px 3px; }
z { display: block; background: yellow; width: 20%; height:10%; }
a {
 position: absolute;
 inset: 0;
 left: auto;
 border: 2px solid lime;
}
</style>
</head>
<body>
<grid>
  <item>1</item>
  <item>2</item>
  <item>3</item>
  <item style="max-width:40px; margin-right:10px">4</item>
  <item>5</item>
  <item>6<a></a></item>
  <item>7</item>
  <item style="writing-mode:vertical-lr">8 vertical</item>
  <item>9<a></a></item>
  <item>10</item>
  <item>11</item>
  <item style="max-width:90px; border:solid; border-width:0 2px; box-sizing:border-box; margin-right:1px">12<z></z></item>
  <item>13</item>
  <item>14<z></z><a></a></item>
  <item>15</item>
  <item style="justify-self:start">16</item>
  <item>17</item>
  <item style="margin:0 auto">18</item>
  <item>19</item>
  <item style="margin-left: auto">20</item>
</grid>
</body></html>
