Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
 - 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-015.html - WPT Dashboard Interop Dashboard
 
 
<!DOCTYPE html>
<html>
<title>Auto-fit repeat tracks with auto size and auto item placement</title>
<link rel="author" title="Alison Maher" href="mailto:almaher@microsoft.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
.masonry {
    display: masonry;
    item-tolerance: 0;
    grid-template-columns: repeat(auto-fit, auto);
    height: 200px;
    width: 1000px;
}
.masonry > div {
    width: 100px;
    height: 100px;
}
</style>
<div class="masonry">
  <div style="grid-column: 1;"></div>
  <div style="grid-column: 3;"></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
</div>
<script>
  test(function() {
    const container = document.querySelector('.masonry');
    const computedStyle = window.getComputedStyle(container);
    // These don't end up being 100px because auto tracks get stretched at the end of
    // track sizing.
    assert_equals(computedStyle.getPropertyValue('grid-template-columns'),
      "250px 250px 250px 250px 0px 0px 0px 0px 0px 0px");
  });
</script>
</html>