summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-scroll-snap/snap-after-initial-layout/scroll-snap-initial-layout-000.html
blob: ea47c9f36cc1f9bfda413dd6b6c9eb697bd54540 (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
<!DOCTYPE html>
<title>
  On-screen vs. Off-screen Snapped Initial Scroll Position (Mandatory and Proximity)
</title>
<link rel="help" href="https://drafts.csswg.org/css-scroll-snap-1/#scroll-snap-align">
<link rel="help" href="https://drafts.csswg.org/css-scroll-snap/#re-snap">
<link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact">
<!-- Test assumes 2px proximity is enough to snap.
     If your implementation has a cogent argument as to why this is too much,
     please request a change to this test. ~fantasai -->
<link rel="match" href="scroll-snap-initial-layout-000-ref.html">

<style>

.scroller {
  scroll-snap-type: both mandatory;
  overflow: hidden;
  scroll-padding: 0;
  width: 100px;
  height: 100px;
  border: solid blue;
  margin: 10px;
  display: inline-block;
}

.mandatory > .scroller {
  scroll-snap-type: both mandatory;
}

.proximity > .scroller {
  scroll-snap-type: both proximity;
}

.scroller > div {
  /* padding wrapper */
  width: 30px;
}

.scroller > div > div {
  /* target box */
  height: 30px;
  background: orange;
  scroll-snap-align: start;
}

.proxfar {
  border-color: orange;
}
.proxfar > div > div {
  background: red;
}

</style>

<p>Test passes if there is an orange square precisely at the top left corner of each blue box (no gap),
and each orange box is empty.


<div class="mandatory">
  <!-- off-screen -->
  <div class="scroller">
    <div style="padding: 110px;"><div class="small-target"></div></div>
  </div>

  <div class="scroller">
    <div style="padding-block: 110px;"><div class="small-target"></div></div>
  </div>

  <div class="scroller">
    <div style="padding-inline: 110px;"><div class="small-target"></div></div>
  </div>

  <!-- on-screen -->
  <div class="scroller">
    <div style="padding: 90px;"><div class="small-target"></div></div>
  </div>

  <div class="scroller">
    <div style="padding-block: 90px;"><div class="small-target"></div></div>
  </div>

  <div class="scroller">
    <div style="padding-inline: 90px;"><div class="small-target"></div></div>
  </div>
</div>

<div class="proximity">
  <!-- off-screen -->
  <div class="scroller proxfar">
    <div style="padding: 110px;"><div class="small-target"></div></div>
  </div>

  <div class="scroller proxfar">
    <div style="padding-block: 110px;"><div class="small-target"></div></div>
  </div>

  <div class="scroller proxfar">
    <div style="padding-inline: 110px;"><div class="small-target"></div></div>
  </div>

  <!-- on-screen -->
  <div class="scroller">
    <div style="padding: 2px 110px 110px 2px;"><div class="small-target"></div></div>
  </div>

  <div class="scroller">
    <div style="padding: 2px 110px 110px 2px;"><div class="small-target"></div></div>
  </div>

  <div class="scroller">
    <div style="padding: 2px 110px 110px 2px;"><div class="small-target"></div></div>
  </div>
</div>