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/intrinsic-auto-repeat/column-auto-repeat-auto-004.html - WPT Dashboard Interop Dashboard
 
 
<!DOCTYPE html>
<html>
<title>Auto repeat tracks with auto track sizes and spanning children with gap</title>
<link rel="match" href="column-auto-repeat-auto-004-ref.html">
<link rel="author" title="Alison Maher" href="mailto:almaher@microsoft.com">
<style>
.masonry {
    display: masonry;
    background: gray;
    item-tolerance: 0;
    grid-template-columns: repeat(auto-fill, auto);
    grid-gap: 20px;
    width: 400px;
    height: 260px;
}
.masonry > div {
    height: 50px;
}
</style>
<body>
  <div class="masonry">
    <div style="background: lightskyblue; grid-column: span 2; width: 200px">
      Number 1
    </div>
    <div style="background: lightcoral; grid-column: span 3; width: 300px;">
      Number 2
    </div>
    <div style="background: lightgreen; grid-column: span 4; width: 400px;">
      Number 3
    </div>
    <div style="background: lightpink; grid-column: span 2; width: 200px;">
      Number 4
    </div>
  </div>
</body>
</html>