blob: e059f414dc7f40844f01cb892c86ba5de9d51d82 [file] [log] [blame]
<!DOCTYPE HTML>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
<meta charset="utf-8">
<title>Reference: Grid axis fragmentation with column masonry layout</title>
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
<style>
html,body {
color:black; background-color:white; font:10px/1 monospace; padding:0; margin:0;
}
wrapper {
display: block;
width: 600px;
height: 600px;
overflow: hidden;
}
.columns {
columns: 3;
column-fill: auto;
background: lightgrey;
margin-bottom: 15px;
}
.grid {
display: grid;
grid: 20px auto 30px / auto;
border: solid;
border-width: 3px 1px 7px 5px;
padding: 1px 3px 5px 7px;
gap: 1px 5px;
}
x {
background: cyan;
min-width: 20px;
min-height: 10px;
}
y {
background: blue;
width: 35px;
}
z {
background: gray;
width: 40px;
}
masonry-track {
display: grid;
justify-content: space-between;
column-gap: 5px;
}
</style>
</head>
<body>
<wrapper style="display:none">
<div class="columns" style="height:90px">
<div class="grid">
<masonry-track><x></x><y></y><y></y><x></x></masonry-track>
<masonry-track><x></x><x></x><x></x><z></z></masonry-track>
<masonry-track><z></z><z></z><x></x><z></z></masonry-track>
</div>
</div>
<div class="columns" style="height:68px">
<div class="grid">
<masonry-track><x></x><y></y><y></y><x></x></masonry-track>
<masonry-track><x></x><x></x><x></x><z></z></masonry-track>
<masonry-track><z></z><z></z><x></x><z></z></masonry-track>
</div>
</div>
<div class="columns" style="height:48px">
<div class="grid">
<masonry-track><x></x><y></y><y></y><x></x></masonry-track>
<masonry-track><x></x><x></x><x></x><z></z></masonry-track>
<masonry-track><z></z><z></z><x></x><z></z></masonry-track>
</div>
</div>
<div class="columns" style="height:38px">
<div class="grid">
<masonry-track><x></x><y></y><y></y><x></x></masonry-track>
<masonry-track><x></x><x></x><x></x><z></z></masonry-track>
<masonry-track><z></z><z></z><x></x><z></z></masonry-track>
</div>
</div>
<div class="columns" style="height:28px">
<div class="grid">
<masonry-track><x></x><y></y><y></y><x></x></masonry-track>
<masonry-track><x></x><x></x><x></x><z></z></masonry-track>
<masonry-track><z></z><z></z><x></x><z></z></masonry-track>
</div>
</div>
<div class="columns" style="height:18px">
<div class="grid">
<masonry-track><x></x><y></y><y></y><x></x></masonry-track>
<masonry-track><x></x><x></x><x></x><z></z></masonry-track>
<masonry-track><z></z><z></z><x></x><z></z></masonry-track>
</div>
</div>
</wrapper>
<script>
let wrapper = document.querySelectorAll("wrapper")[0];
let grids = document.querySelectorAll(".grid");
for (let e of grids) {
for (let track of e.children) {
track.style.gridTemplateColumns = "repeat(" + track.children.length + ",auto)";
}
}
wrapper.style.display="";
</script>
</body>
</html>