Skip to content

Commit 38e44dd

Browse files
committed
merge
2 parents 5f97d52 + 170d0fa commit 38e44dd

1 file changed

Lines changed: 46 additions & 44 deletions

File tree

css-scroll-snap/Overview.bs

Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,7 @@ Scroll Snapping Alignment: the 'scroll-snap-align' property {#scroll-snap-align}
452452
its <a>snap area</a> (as the <a>alignment subject</a>)
453453
within the viewport's <a>snap viewport</a> (as the <a>alignment container</a>).
454454
The <a>scroll alignment values</a> can be specified per-axis,
455-
or as a simultaneous 2D alignment position,
456-
by using a <a>scroll axis keyword</a>.
455+
or as a simultaneous 2D alignment position.
457456

458457
<pre class="prod">
459458
<dfn for=scroll-snap-align><<snap-alignment>></dfn> = center | [ start | end ] <<percentage>>?
@@ -483,7 +482,50 @@ Scroll Snapping Alignment: the 'scroll-snap-align' property {#scroll-snap-align}
483482
<pre>img { scroll-snap-align: center; }</pre>
484483
</div>
485484

486-
The <dfn>scroll alignment values</dfn> are defined as follows:
485+
'scroll-snap-align' has four distinct families of values,
486+
depending on what <a>snap positions</a> you wish the element to declare:
487+
488+
<dl>
489+
<dt id=scroll-snap-align-none>none
490+
<dd>
491+
The element does not declare any <a>snap positions</a> at all.
492+
493+
<dt id=scroll-snap-align-single>[ block | inline ]? [ edges | <<snap-alignment>> ]
494+
<dd>
495+
The element declares a single <a>1D snap position</a>,
496+
in either the <a>block</a> or <a>inline</a> axis.
497+
498+
If neither <css>block</css> nor <css>inline</css> is specified,
499+
the axis is automatically chosen:
500+
501+
* If the element is only scrollable in one axis
502+
(only one axis has its 'overflow' set to ''overflow/auto'' or ''overflow/scroll'')
503+
the scrollable axis is chosen.
504+
* Otherwise, the <a>block</a> axis is chosen.
505+
506+
<dt id=scroll-snap-align-double>[ none | edges | <<snap-alignment>> ]{2}
507+
<dd>
508+
The element declares two <a>1D snap positions</a>,
509+
one in each axis.
510+
The first value is in the <a>block</a> axis,
511+
and the second is in the <a>inline</a> axis.
512+
513+
<dt id=scroll-snap-align-2d>point <<snap-alignment>>{1,2}
514+
<dd>
515+
The element declares a <a>2D snap position</a>.
516+
517+
If both alignments are given,
518+
the first refers to the <a>block</a> axis
519+
and the second refers to the <a>inline</a> axis.
520+
If only one is given,
521+
the position refers to both axises.
522+
</dl>
523+
524+
For all of these values,
525+
the <a>block</a> or <a>inline</a> axis
526+
is relative to the element's parent's <a>writing mode</a>.
527+
528+
The <dfn export>scroll alignment values</dfn> are defined as follows:
487529

488530
<dl dfn-for=scroll-snap-align dfn-type=value>
489531
<dt><dfn>none</dfn>
@@ -524,47 +566,6 @@ Scroll Snapping Alignment: the 'scroll-snap-align' property {#scroll-snap-align}
524566
are valid <a>snap positions</a>.
525567
</dl>
526568

527-
The <dfn>scroll axis keywords</dfn>
528-
allow explicitly targeting a specific axis
529-
or requesting simultaneous 2D alignment,
530-
and are defined as follows:
531-
532-
<dl dfn-type=value dfn-for=scroll-snap-align>
533-
<dt><dfn>inline</dfn>
534-
<dt><dfn>block</dfn>
535-
<dd>
536-
The specified alignment applies to the inline or block axis, respectively.
537-
The computed alignment of the opposite axis is set to ''scroll-snap-align/none''.
538-
539-
<div class="example">
540-
The following two declarations are equivalent:
541-
<pre>
542-
scroll-snap-align: none start;
543-
scroll-snap-align: block start;
544-
</pre>
545-
</div>
546-
547-
<dt><dfn>point</dfn>
548-
<dd>
549-
Specifies 2D snapping:
550-
the <a>snap position</a> is only valid when both axes are aligned as specified;
551-
otherwise the <a>snap position</a> in each axis
552-
is independent of alignment in the other axis.
553-
</dl>
554-
555-
If two <<snap-alignment>> values are specified, then
556-
the first value specifies alignment in the inline axis;
557-
and the second value (if any) specifies alignment in the block axis.
558-
559-
If only one value is specified
560-
and no <a>scroll axis keyword</a> is specified, then
561-
the <<snap-alignment>> value
562-
applies to the scrollable axis of the affected <a>scroll container</a>.
563-
If both axes are scrollable
564-
(i.e. both 'overflow-x' and 'overflow-y' are either ''overflow/scroll'' or ''overflow/auto''),
565-
then it applies to the block axis of the affected <a>scroll container</a>
566-
(as determined by the <a>scroll container</a>’s <a>writing mode</a>).
567-
568569
Note: Remember that in <a>vertical writing modes</a> the block and inline axes
569570
correspond to the x and y axes, and not the y and x axes, respectively.
570571

@@ -591,6 +592,7 @@ Scroll Snapping Alignment: the 'scroll-snap-align' property {#scroll-snap-align}
591592

592593
<details class="why">
593594
<summary>Why no <<length>> or <<position>> values?</summary>
595+
594596
The values here represent alignments
595597
(in the sense of 'align-self' and 'justify-self'),
596598
so are consistent with that syntax.

0 commit comments

Comments
 (0)