blob: e8025d679ed00b391df492b5d5a36b3d2ce82910 (
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
|
<!DOCTYPE html>
<meta charset="UTF-8">
<title>CSS Position Test: sticky element with top offset specified with px unit</title>
<link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
<link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos">
<link rel="match" href="reference/position-sticky-top-002-ref.html">
<meta name="flags" content="">
<style>
div.scrolling-container
{
background-image: url("support/100x100-red.png");
background-repeat: no-repeat;
display: inline-block;
height: 250px;
margin-right: 30px;
overflow: auto;
position: static;
width: 150px;
}
div#first-scrolling-container
{
background-position: left bottom;
}
div#second-scrolling-container
{
background-position: left 100px;
}
div#third-scrolling-container
{
background-position: left 50px;
}
div.vertical-spacer
{
height: 100px;
}
div.sticky
{
background-color: green;
height: 100px;
position: sticky;
top: 100px;
width: 100px;
}
</style>
<body onload="document.getElementById("first-scrolling-container").scrollTop = 50; document.getElementById("second-scrolling-container").scrollTop = 200; document.getElementById("third-scrolling-container").scrollTop = 300;">
<p>Test passes if there are 3 filled green squares and <strong>no red</strong>.
<!--
first-scrolling-container: before reaching the sticking point
-->
<div id="first-scrolling-container" class="scrolling-container"> <!-- 150w x 250h viewport -->
<div class="vertical-spacer"></div> <!-- 150w x 100h -->
<div class="content">
<div class="vertical-spacer"></div> <!-- 150w x 100h -->
<div id="first-sticky" class="sticky"></div> <!-- 100w x 100h -->
<div class="vertical-spacer"></div> <!-- 150w x 100h -->
</div>
<div class="vertical-spacer"></div> <!-- 150w x 100h -->
</div>
<!--
second-scrolling-container: when reaching the sticking point and beyond
-->
<div id="second-scrolling-container" class="scrolling-container"> <!-- 150w x 250h viewport -->
<div class="vertical-spacer"></div> <!-- 150w x 100h -->
<div class="content">
<div class="vertical-spacer"></div> <!-- 150w x 100h -->
<div id="second-sticky" class="sticky"></div> <!-- 100w x 100h -->
<div class="vertical-spacer"></div> <!-- 150w x 100h -->
</div>
<div class="vertical-spacer"></div> <!-- 150w x 100h -->
</div>
<div id="third-scrolling-container" class="scrolling-container"> <!-- 150w x 250h viewport -->
<div class="vertical-spacer"></div> <!-- 150w x 100h -->
<div class="content">
<div class="vertical-spacer"></div> <!-- 150w x 100h -->
<div id="third-sticky" class="sticky"></div> <!-- 100w x 100h -->
<div class="vertical-spacer"></div> <!-- 150w x 100h -->
</div>
<div class="vertical-spacer"></div> <!-- 150w x 100h -->
</div>
|