rly resized">
</head>

<style>
  grid {
    display: inline-grid;
    display: inline-masonry;
    grid-template-rows: masonry;
    grid-template-columns: auto;
    grid-gap: 10px;
    border: 10px;
    border-style: solid;
  }
  item {
    background-color: grey;
    height: 250px;
    width: 250px;
  }
</style>
</head>
<body>
  <grid>
    <item>1</item>
    <item>2</item>
  </grid>
</body>
<script>
    document.body.offsetHeight; // Force a relayout
    var gridItem = document.querySelector('item');
    g