summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-grid/masonry/tentative/fragmentation/masonry-fragmentation-002.html
blob: 76a0540fa92f1715de1a1ff5a67671548d4f15b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE HTML>
<!--
     Any copyright is dedicated to the Public Domain.
     http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
  <meta charset="utf-8">
  <title>CSS Grid Test: Masonry layout fragmentation</title>
  <link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
  <link rel="help" href="https://drafts.csswg.org/css-grid-3">
  <link rel="match" href="masonry-fragmentation-002-ref.html">
  <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 {
  width: 330px;
  columns: 6;
  column-fill: auto;
  column-gap: 1px;
  background-color: rgba(80,80,80,.2);
  margin-bottom: 10px;
}
.columns:nth-child(2n) {
  background-color: rgba(10,100,10,.5);
}
.grid {
  display: grid;
  grid-template-columns: 10px 15px 20px;
  grid-template-rows: masonry;
  border: 1px solid;
  gap: 2px;
}
x {
  background: cyan;
  height: 5px;
  break-inside: avoid;
}
x:nth-child(4n) {
  grid-column: span 2;
  background: blue;
  height: 10px;
  break-inside: auto;
}
x:nth-child(5n) {
  background: pink;
  height: 12px;
  break-inside: avoid;
}
</style></head>
<body>
<wrapper style="display:none">
<div style="display:none">
<div class="columns">
  <div class="grid">
    <x></x><x></x><x></x><x></x><x></x><x></x><x></x><x></x><x></x><x></x><x></x><x></x>
    <x></x><x></x><x></x><x></x><x></x><x></x><x></x><x></x><x></x><x></x><x></x><x></x>
  </div>
</div>
</div>
<script>
let wrapper = document.querySelectorAll("wrapper")[0];
let tmplt = document.querySelectorAll(".columns")[0];
let heights = [ 48, 18 ];
for (let h of heights) {
  let e = tmplt.cloneNode(true);
  e.style.height = h + "px";
  wrapper.appendChild(e);
}
wrapper.style.display="";
</script>
</wrapper>
</body>
</html>