summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-grid/alignment/grid-content-alignment-with-span-001.html
blob: 6333c13b00b58752e3facf3631de269641e4ea09 (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<!DOCTYPE html>
<html>
<head>
<title>CSS Grid Layout Test: content alignment and items spanning multiple tracks.</title>
<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-grid/#alignment">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#auto-tracks">
<link rel="help" href="https://drafts.csswg.org/css-align-3/#distribution-values">
<link rel="help" href="https://drafts.csswg.org/css-align-3/#content-distribution">
<link rel="help" href="https://drafts.csswg.org/css-align-3/#propdef-align-content">
<link rel="help" href="https://drafts.csswg.org/css-align-3/#propdef-justify-content">
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=376823">
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=249451">
<link rel="stylesheet" href="/css/support/grid.css">
<link rel="stylesheet" href="/css/support/alignment.css">
<meta name="assert" content="Test that content distribution alignment is applied correctly when items span more than one track." />

<style>
body {
  margin: 0px;
}

.grid {
  grid-auto-columns: 20px;
  grid-auto-rows: 40px;
  grid-template-areas: "a a b"
                       "c d b";
  position: relative;
  width: 300px;
  height: 200px;
}
.a {
  grid-area: a;
  background-color: blue;
}
.b {
  grid-area: b;
  background-color: lime;
}
.c {
  grid-area: c;
  background-color: purple;
}
.d {
  grid-area: d;
  background-color: orange;
}
.stretchedGrid {
  grid-auto-columns: auto;
  grid-auto-rows: auto;
}
</style>

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>
</head>

<body onload="checkLayout('.grid')">

<div style="position: relative">
  <p>direction: LTR | distribution: 'space-between'</p>
  <div class="grid contentSpaceBetween" data-expected-width="300" data-expected-height="200">
    <div class="a" data-offset-x="0" data-offset-y="0" data-expected-width="160" data-expected-height="40"></div>
    <div class="b" data-offset-x="280" data-offset-y="0" data-expected-width="20" data-expected-height="200"></div>
    <div class="c" data-offset-x="0" data-offset-y="160" data-expected-width="20" data-expected-height="40"></div>
    <div class="d" data-offset-x="140" data-offset-y="160" data-expected-width="20" data-expected-height="40"></div>
  </div>
</div>

<div style="position: relative">
  <p>direction: LTR | distribution: 'space-around'</p>
  <div class="grid contentSpaceAround" data-expected-width="300" data-expected-height="200">
    <div class="a" data-offset-x="40" data-offset-y="30" data-expected-width="120" data-expected-height="40"></div>
    <div class="b" data-offset-x="240" data-offset-y="30" data-expected-width="20" data-expected-height="140"></div>
    <div class="c" data-offset-x="40" data-offset-y="130" data-expected-width="20" data-expected-height="40"></div>
    <div class="d" data-offset-x="140" data-offset-y="130" data-expected-width="20" data-expected-height="40"></div>
  </div>
</div>

<div style="position: relative">
  <p>direction: LTR | distribution: 'space-evenly'</p>
  <div class="grid contentSpaceEvenly" data-expected-width="300" data-expected-height="200">
    <div class="a" data-offset-x="60" data-offset-y="40" data-expected-width="100" data-expected-height="40"></div>
    <div class="b" data-offset-x="220" data-offset-y="40" data-expected-width="20" data-expected-height="120"></div>
    <div class="c" data-offset-x="60" data-offset-y="120" data-expected-width="20" data-expected-height="40"></div>
    <div class="d" data-offset-x="140" data-offset-y="120" data-expected-width="20" data-expected-height="40"></div>
  </div>
</div>

<div style="position: relative">
  <p>direction: LTR | distribution: 'stretch'</p>
  <div class="grid stretchedGrid contentStretch" data-expected-width="300" data-expected-height="200">
    <div class="a" data-offset-x="0" data-offset-y="0" data-expected-width="200" data-expected-height="100"></div>
    <div class="b" data-offset-x="200" data-offset-y="0" data-expected-width="100" data-expected-height="200"></div>
    <div class="c" data-offset-x="0" data-offset-y="100" data-expected-width="100" data-expected-height="100"></div>
    <div class="d" data-offset-x="100" data-offset-y="100" data-expected-width="100" data-expected-height="100"></div>
  </div>
</div>

<!-- RTL direction. -->
<div style="position: relative">
  <p>direction: RTL | distribution: 'space-between'</p>
  <div class="grid contentSpaceBetween directionRTL" data-expected-width="300" data-expected-height="200">
    <div class="a" data-offset-x="140" data-offset-y="0" data-expected-width="160" data-expected-height="40"></div>
    <div class="b" data-offset-x="0" data-offset-y="0" data-expected-width="20" data-expected-height="200"></div>
    <div class="c" data-offset-x="280" data-offset-y="160" data-expected-width="20" data-expected-height="40"></div>
    <div class="d" data-offset-x="140" data-offset-y="160" data-expected-width="20" data-expected-height="40"></div>
  </div>
</div>

<div style="position: relative">
  <p>direction: RTL | distribution: 'space-around'</p>
  <div class="grid contentSpaceAround directionRTL" data-expected-width="300" data-expected-height="200">
    <div class="a" data-offset-x="140" data-offset-y="30" data-expected-width="120" data-expected-height="40"></div>
    <div class="b" data-offset-x="40" data-offset-y="30" data-expected-width="20" data-expected-height="140"></div>
    <div class="c" data-offset-x="240" data-offset-y="130" data-expected-width="20" data-expected-height="40"></div>
    <div class="d" data-offset-x="140" data-offset-y="130" data-expected-width="20" data-expected-height="40"></div>
  </div>
</div>

<div style="position: relative">
  <p>direction: RTL | distribution: 'space-evenly''</p>
  <div class="grid contentSpaceEvenly directionRTL" data-expected-width="300" data-expected-height="200">
    <div class="a" data-offset-x="140" data-offset-y="40" data-expected-width="100" data-expected-height="40"></div>
    <div class="b" data-offset-x="60" data-offset-y="40" data-expected-width="20" data-expected-height="120"></div>
    <div class="c" data-offset-x="220" data-offset-y="120" data-expected-width="20" data-expected-height="40"></div>
    <div class="d" data-offset-x="140" data-offset-y="120" data-expected-width="20" data-expected-height="40"></div>
  </div>
</div>

<div style="position: relative">
  <p>direction: RTL | distribution: 'stretch'</p>
  <div class="grid stretchedGrid contentStretch directionRTL" data-expected-width="300" data-expected-height="200">
    <div class="a" data-offset-x="100" data-offset-y="0" data-expected-width="200" data-expected-height="100"></div>
    <div class="b" data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="200"></div>
    <div class="c" data-offset-x="200" data-offset-y="100" data-expected-width="100" data-expected-height="100"></div>
    <div class="d" data-offset-x="100" data-offset-y="100" data-expected-width="100" data-expected-height="100"></div>
  </div>
</div>

</body>
</html>