Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
            
- /css/css-grid/masonry/tentative/track-sizing/auto-repeat/row-auto-repeat-021.html - WPT Dashboard Interop Dashboard
 
 
<!DOCTYPE html>
<html>
<title>Auto-fit repeat tracks with fixed size and explicit item placement</title>
<link rel="match" href="row-auto-repeat-021-ref.html">
<link rel="author" title="Alison Maher" href="mailto:almaher@microsoft.com">
<style>
.masonry {
    display: masonry;
    background: gray;
    item-tolerance: 0;
    masonry-direction: row;
    grid-template-rows: 100px repeat(auto-fit, 100px);
    width: 500px;
    height: 300px;
}
.masonry > div {
    height: 100%;
    width: 100px;
}
</style>
<body>
  <div class="masonry">
    <!-- Only row 2 should get collapsed -->
    <div style="background: lightskyblue; grid-row: 3;">
      Number 1
    </div>
    <div style="background: lightcoral; grid-row: 3;">
      Number 2
    </div>
    <div style="background: lightgreen; grid-row: 3;">
      Number 3
    </div>
    <div style="background: lightpink; grid-row: 3;">
      Number 4
    </div>
    <div style="background: orange; grid-row: 3;">
      Number 5
    </div>
  </div>
</body>
</html>