<!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 `align-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-align-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: masonry;
  grid-template-columns: 150px 100px 50px;
  gap: 3px 5px;
  padding: 10px;
  border: 3px solid;
  background: lightgrey content-box;
  align-tracks: stretch;
  height: 500px;
}
item {
  background: grey;
  height: 30px;
  position: relative;
}
item:nth-child(2n) { background:purple; height:auto; }
item:nth-child(1) { border:10px solid; margin: 10px 0 5px 3px; }
z { display: block; background: yellow; height: 20%; width:80%; }
a {
 position: absolute;
 inset: 0;
 top: auto;
 border: 2px solid lime;
}
</style>
</head>
<body>
<grid>
  <item>1</item>
  <item>2</item>
  <item>3</item>
  <item style="max-height:40px; margin-top: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 A<br>B</item>
  <item>11</item>
  <item>12<br><br><z></z></item>
  <item>13</item>
  <item style="max-height:120px; border:2px solid; box-sizing:border-box; margin:1px">14<z></z><a></a></item>
  <item>15</item>
  <item style="align-self:end">16</item>
  <item>17</item>
  <item style="margin:auto 0">18</item>
  <item>19</item>
  <item style="margin-top: auto">20</item>
</grid>
</body></html>
