@@ -21,92 +21,92 @@ Status Text:
21
21
Introduction {#intro}
22
22
=====================
23
23
24
- <em> This section is not normative.</em>
24
+ <em> This section is not normative.</em>
25
25
26
- <em> This is currently a draft spec over Scroll Snap 1.</em>
26
+ <em> This is currently a draft spec over Scroll Snap 1.</em>
27
27
28
- Scroll experiences don't always start at the beginning. Interactions with
29
- carousels, swipe controls, and listviews often start somewhere in the middle,
30
- and each require Javascript to set this position on page load.
31
- By enabling CSS to specify this scroll start x or y position,
32
- both users, page authors and browsers benefit.
28
+ Scroll experiences don't always start at the beginning. Interactions with
29
+ carousels, swipe controls, and listviews often start somewhere in the middle,
30
+ and each require Javascript to set this position on page load.
31
+ By enabling CSS to specify this scroll start x or y position,
32
+ both users, page authors and browsers benefit.
33
33
34
- In addition to setting an initial scroll position,
35
- developers need insights and events into Scroll Snap
36
- like which element is snapped on an axis,
37
- when the snap event is changing and/or indeterminate,
38
- events for snap completion, and conveniences for
39
- snapping to children programatically.
34
+ In addition to setting an initial scroll position,
35
+ developers need insights and events into Scroll Snap
36
+ like which element is snapped on an axis,
37
+ when the snap event is changing and/or indeterminate,
38
+ events for snap completion, and conveniences for
39
+ snapping to children programatically.
40
40
41
41
42
42
Setting Where Scroll Starts {#properties-on-the-scroll-container}
43
- ======================================================================================================
43
+ =================================================================
44
44
45
45
<!-- BIG TEXT: SCROLL START -->
46
46
47
47
The 'scroll-start' property {#scroll-start}
48
- --------------------------------------------------------------------------
49
-
50
- <pre class="propdef">
51
- Name : scroll-start
52
- Value : auto | [end | center] | <<length-percentage>>
53
- Initial : none
54
- Applies to : all elements
55
- Inherited : no
56
- Percentages : n/a
57
- Computed value : specified keyword(s)
58
- Animation type : discrete
59
- </pre>
48
+ -------------------------------------------
49
+
50
+ <pre class="propdef">
51
+ Name : scroll-start
52
+ Value : auto | [end | center] | <<length-percentage>>
53
+ Initial : none
54
+ Applies to : all elements
55
+ Inherited : no
56
+ Percentages : n/a
57
+ Computed value : specified keyword(s)
58
+ Animation type : discrete
59
+ </pre>
60
60
61
61
This property is a shorthand property that sets all of the scroll-start-* longhands in one declaration. It does not work like 'margin' , where a value is repeated to all sides. {{scroll-start: 200px}} is not {{scroll-start: 200px 200px}} , it's {{scroll-start: 200px 0}} . Inline is first, followed by block.
62
62
63
63
Values are defined as follows:
64
64
65
- <dl dfn-type=value dfn-for="scroll-snap-type">
66
- <dt> <dfn>end</dfn>
67
- <dd>
68
- Scroll position starts at the end of a <a>scroll container</a> .
69
- Property value is at risk, may be duplicative.
65
+ <dl dfn-type=value dfn-for="scroll-snap-type">
66
+ <dt> <dfn>end</dfn>
67
+ <dd>
68
+ Scroll position starts at the end of a <a>scroll container</a> .
69
+ Property value is at risk, may be duplicative.
70
70
71
- <dt> <dfn>center</dfn>
72
- <dd>
73
- Scroll position starts at the middle of a <a>scroll container</a> .
74
- Property value is at risk, may be duplicative.
75
- </dl>
71
+ <dt> <dfn>center</dfn>
72
+ <dd>
73
+ Scroll position starts at the middle of a <a>scroll container</a> .
74
+ Property value is at risk, may be duplicative.
75
+ </dl>
76
76
77
77
Styling Snapped Items {#todo}
78
- ======================================================================================================
78
+ =============================
79
79
80
80
The Snapped-element Pseudo-class: ':snapped' {#snapped}
81
- --------------------------------------------------------------------------
81
+ -------------------------------------------------------
82
82
83
83
The {{:snapped}} pseudo-class matches any scroll snap
84
84
targets, regardless of axis. The longform physical and logical pseudo-class
85
- selectors allow for more finite snapped children styling
85
+ selectors allow for more finite snapped children styling
86
86
as they can target an individual axis.
87
87
88
88
More specific options are defined as follows:
89
89
90
- <dl dfn-type=value dfn-for="scroll-snap-type">
91
- <dt> <dfn>:snapped-x</dfn>
92
- <dd>
93
- Matches the child snapped on the {{x}} axis.
90
+ <dl dfn-type=value dfn-for="scroll-snap-type">
91
+ <dt> <dfn>:snapped-x</dfn>
92
+ <dd>
93
+ Matches the child snapped on the {{x}} axis.
94
94
95
- <dt> <dfn>:snapped-y</dfn>
96
- <dd>
97
- Matches the child snapped on the {{y}} axis.
95
+ <dt> <dfn>:snapped-y</dfn>
96
+ <dd>
97
+ Matches the child snapped on the {{y}} axis.
98
98
99
- <dt> <dfn>:snapped-inline</dfn>
100
- <dd>
101
- Matches the child snapped on the {{inline}} axis.
99
+ <dt> <dfn>:snapped-inline</dfn>
100
+ <dd>
101
+ Matches the child snapped on the {{inline}} axis.
102
102
103
- <dt> <dfn>:snapped-block</dfn>
104
- <dd>
105
- Matches the child snapped on the {{block}} axis.
106
- </dl>
103
+ <dt> <dfn>:snapped-block</dfn>
104
+ <dd>
105
+ Matches the child snapped on the {{block}} axis.
106
+ </dl>
107
107
108
108
Snap Events {#todo}
109
- ======================================================================================================
109
+ ===================
110
110
111
111
<!--
112
112
████████ ██ ██ ████████ ██ ██ ████████ ██████
@@ -119,28 +119,28 @@ Snap Events {#todo}
119
119
-->
120
120
121
121
'snapChanged' and 'snapChanging'
122
- --------------------------------------------------------------------------
123
-
124
- CSS scroll snap points are often used as a mechanism to
125
- create scroll interactive "selection" components,
126
- where selection is determined with javascript intersection observers
127
- and a scroll end guestimate. By creating a built-in event,
128
- the invisible state will become actionable,
129
- at the right time, and always correct.
130
-
131
- <table class="data" id="eventhandlers">
132
- <thead>
133
- <tr>
134
- <th> Event handler
135
- <th> Event handler event type
136
- <tbody>
137
- <tr>
138
- <th> {{snapChanged}}
139
- <td> {{scroll!!event}}
140
- <tr>
141
- <th> {{snapChanging}}
142
- <td> {{scroll!!event}}
143
- </table>
122
+ --------------------------------
123
+
124
+ CSS scroll snap points are often used as a mechanism to
125
+ create scroll interactive "selection" components,
126
+ where selection is determined with javascript intersection observers
127
+ and a scroll end guestimate. By creating a built-in event,
128
+ the invisible state will become actionable,
129
+ at the right time, and always correct.
130
+
131
+ <table class="data" id="eventhandlers">
132
+ <thead>
133
+ <tr>
134
+ <th> Event handler
135
+ <th> Event handler event type
136
+ <tbody>
137
+ <tr>
138
+ <th> {{snapChanged}}
139
+ <td> {{scroll!!event}}
140
+ <tr>
141
+ <th> {{snapChanging}}
142
+ <td> {{scroll!!event}}
143
+ </table>
144
144
145
145
<!--
146
146
██ ███████ ██ ██ ██████ ██ ██ ███ ██ ██ ████████ ██████
@@ -161,31 +161,31 @@ interact as defined in [[!CSS-LOGICAL-1]].
161
161
Physical Longhands for 'scroll-start' {#scroll-start-longhands-physical}
162
162
----------------------------------------------------------------------
163
163
164
- <pre class="propdef">
165
- Name : scroll-start-x, scroll-start-y
166
- Value : auto | [end | center] | <<length-percentage>>
167
- Initial : auto
168
- Applies to : <a>scroll containers</a>
169
- Inherited : no
170
- Percentages : relative to the scroll container’s scrollport
171
- Computed value : the keyword ''scroll-start/auto'' or a computed <<length-percentage>> value
172
- Animation type : by computed value type
173
- </pre>
164
+ <pre class="propdef">
165
+ Name : scroll-start-x, scroll-start-y
166
+ Value : auto | [end | center] | <<length-percentage>>
167
+ Initial : auto
168
+ Applies to : <a>scroll containers</a>
169
+ Inherited : no
170
+ Percentages : relative to the scroll container’s scrollport
171
+ Computed value : the keyword ''scroll-start/auto'' or a computed <<length-percentage>> value
172
+ Animation type : by computed value type
173
+ </pre>
174
174
175
- Negative values are invalid.
175
+ Negative values are invalid.
176
176
177
177
Flow-relative Longhands for 'scroll-start' {#scroll-start-longhands-logical}
178
178
--------------------------------------------------------------------------
179
179
180
- <pre class="propdef">
181
- Name : scroll-start-inline, scroll-start-block
182
- Value : auto | [end | center] | <<length-percentage>>
183
- Initial : auto
184
- Applies to : <a>scroll containers</a>
185
- Inherited : no
186
- Percentages : relative to the scroll container’s scrollport
187
- Computed value : the keyword ''scroll-start/auto'' or a computed <<length-percentage>> value
188
- Animation type : by computed value type
189
- </pre>
190
-
191
- Negative values are invalid.
180
+ <pre class="propdef">
181
+ Name : scroll-start-inline, scroll-start-block
182
+ Value : auto | [end | center] | <<length-percentage>>
183
+ Initial : auto
184
+ Applies to : <a>scroll containers</a>
185
+ Inherited : no
186
+ Percentages : relative to the scroll container’s scrollport
187
+ Computed value : the keyword ''scroll-start/auto'' or a computed <<length-percentage>> value
188
+ Animation type : by computed value type
189
+ </pre>
190
+
191
+ Negative values are invalid.
0 commit comments