@@ -220,17 +220,19 @@ Choosing A Positioning Scheme: 'position' property</h2>
220220 and does not affect the size or position of any other box,
221221 except insofar as it increases the [=scrollable overflow area=] of its ancestors.
222222 This [=positioning scheme=] is called
223- <dfn export dfn lt="relative position|relatively position">relative positioning</dfn> .
223+ <dfn export dfn lt="relative position|relatively position" local-lt="relative|relatively" >relative positioning</dfn> .
224224
225225 <dt> <dfn>sticky</dfn>
226226 <dd>
227227 Identical to ''relative'' ,
228- except that a offset is automatically adjusted
228+ except that its offsets are automatically adjusted
229229 in reference to the nearest ancestor [=scroll container's=] [=scrollport=]
230- as modified by the [=inset properties=] ,
231- in the axes whose [=inset property=] values are not both ''top/auto'' .
230+ (as modified by the [=inset properties=] )
231+ in whichever axes the [=inset properties=] are not both ''top/auto'' ,
232+ to try to keep the box in view within its [=containing block=]
233+ as the user scrolls.
232234 This [=positioning scheme=] is called
233- <dfn export dfn lt="sticky position">sticky positioning</dfn> .
235+ <dfn export dfn lt="sticky position" local-lt="sticky" >sticky positioning</dfn> .
234236
235237 <dt> <dfn>absolute</dfn>
236238 <dd>
@@ -244,7 +246,7 @@ Choosing A Positioning Scheme: 'position' property</h2>
244246 It can overlap in-flow siblings
245247 or other [=absolutely positioned=] elements.
246248 This [=positioning scheme=] is called
247- <dfn export dfn lt="absolute position|absolutely position">absolute positioning</dfn> .
249+ <dfn export dfn lt="absolute position|absolutely position" local-lt="absolute|absolutely" >absolute positioning</dfn> .
248250
249251 <dt> <dfn>fixed</dfn>
250252 <dd>
@@ -255,7 +257,7 @@ Choosing A Positioning Scheme: 'position' property</h2>
255257 it does not move when the document is scrolled,
256258 and is replicated on every page when it is paginated.
257259 This [=positioning scheme=] is called
258- <dfn export dfn lt="fixed position">fixed positioning</dfn>
260+ <dfn export dfn lt="fixed position" local-lt="fixed" >fixed positioning</dfn>
259261 and is considered a subset of [=absolute positioning=] .
260262
261263 <div class="example">
@@ -556,73 +558,54 @@ Relative Positioning</h3>
556558<h3 id="sticky-pos">
557559Sticky positioning</h3>
558560
559- A [=sticky positioned=] box
560- is positioned similarly to a <a>relatively positioned</a> box,
561- but the offset is computed with reference to the nearest ancestor with a <a>scrolling box</a> ,
562- or the viewport if no ancestor has a <a>scrolling box</a> .
563-
564- Specifically, once a box has been laid out according to the <a>normal flow</a> or <a>floated</a> ,
565- its sticky offset is computed as described below.
566- Offsetting a box (B1) in this way has no effect on the box (B2) that follows:
567- B2 is given a position as if B1 were not offset
568- and B2 is not re-positioned after B1’s offset is applied.
569- This implies that sticky positioning may cause boxes to overlap.
570- However, if sticky positioning causes an ''overflow: auto'' or ''overflow: scroll'' box to have overflow,
571- the user agent must allow the user to access this content (at its offset position),
572- which, through the creation of a scrolling mechanism, may affect layout.
573-
574- A sticky positioned box keeps its <a>normal flow</a> size,
575- including line breaks and the space originally reserved for it.
576-
577- A sticky positioned box establishes a new <a>containing block</a> for absolutely positioned descendants,
578- just as relative positioning does.
579- The section on <a>containing blocks</a> explains when a sticky positioned box establishes a new <a>containing block</a> .
580-
581- For sticky positioned elements,
582- 'left' , 'right' , 'top' and 'bottom'
583- are offsets from the respective edges of its flow box
584- which are used to constrain the element's offset.
585- Percentage values of 'left' and 'right' refer to the width of its flow box;
586- percentage values of 'top' and 'bottom' refer to the height of its flow box.
587-
588- Issue: Describe which element font-size-relative units are resolved against
589-
590- The offset of a sticky positioned box is computed as follows:
591-
592- 1. A rectangle is computed relative to the containing block of the sticky positioned element,
593- by insetting its flow box rectangle on each side
594- by offsets computed from the 'left' , 'right' , 'top' and 'bottom' properties of the sticky positioned element.
595-
596- Issue: Say what happens if this rectangle is empty
597-
598- 2. The intersection is taken between the resulting rectangle
599- and the containing block of the sticky positioned element.
600- The result, termed the the <dfn export>sticky-constraint rectangle</dfn> ,
601- is a rectangle used to constrain the location of the sticky positioned element.
602-
603- 3. If the sticky positioned element's 'top' style is not ''top/auto'' ,
604- and the sticky positioned element projects above the top of the [=sticky-constraint rectangle=] ,
605- the sticky positioned element is moved down
606- until it is fully contained in the [=sticky-constraint rectangle=] .
607-
608- 4. If the sticky positioned element's 'bottom' style is not ''bottom/auto'' ,
609- and the sticky positioned element projects below the bottom of the [=sticky-constraint rectangle=] ,
610- the sticky positioned element is moved up
611- until it is fully contained in the [=sticky-constraint rectangle=] .
612-
613- 5. If the sticky positioned element's 'left' style is not ''left/auto'' ,
614- and the stickily positioned element projects outside the left of the [=sticky-constraint rectangle=] ,
615- the sticky positioned element is moved right
616- until it is fully contained in the [=sticky-constraint rectangle=] .
617-
618- 6. If the sticky positioned element's 'right' style is not ''right/auto'' ,
619- and the stickily positioned element projects outside the right of the [=sticky-constraint rectangle=] ,
620- the sticky positioned element is moved left
621- until it is fully contained in the [=sticky-constraint rectangle=] .
622-
623- When computing containment of the sticky positioned element
624- within its containing block,
625- margins on the sticky positioned element are taken into account.
561+ [=Sticky positioning=] is similar to [=relative positioning=]
562+ except the offsets are automatically calculated
563+ in reference to the [=nearest scrollport=] .
564+
565+ For a [=sticky positioned=] [=box=] ,
566+ the [=inset properties=]
567+ represent insets from the respective edges of the [=nearest scrollport=] ,
568+ defining the <dfn export>sticky view rectangle</dfn>
569+ used to constrain the box’s position.
570+ (For this purpose an ''top/auto'' value represents a zero inset.)
571+ If this results in a [=sticky view rectangle=] size in any axis
572+ less than the size of the [=border box=] of the [=sticky=] box in that axis,
573+ then the effective end-edge inset in the affected axis is reduced
574+ to bring the [=sticky view rectangle=] ’s size up to
575+ the size of the [=border box=] in that axis.
576+
577+ <div class=example>
578+ For example,
579+ if the [=nearest scrollport=] is ''300px'' tall,
580+ the [=sticky=] box's [=border box=] is ''200px'' tall,
581+ and it has ''top: 20px'' ,
582+ then the top-edge inset of the [=nearest scrollport=] is ''20px'' ,
583+ and the bottom-edge inset is ''0px'' ,
584+ yielding a [=sticky view rectangle=] that is ''280px'' tall.
585+
586+ But if the [=nearest scrollport=] were only ''100px'' tall,
587+ then the effective bottom-edge inset becomes ''-120px'' ,
588+ resulting in a [=sticky view rectangle=] that’s ''200px'' tall,
589+ enough to fully contain the [=margin box=] of the [=sticky=] box.
590+ </div>
591+
592+ For each side of the box,
593+ if the corresponding [=inset property=] is not ''top/auto'' ,
594+ and the corresponding [=border edge=] of the box would be outside
595+ the corresponding edge of the [=sticky viewport rectangle=] ,
596+ then the box must be visually shifted (as for relative positioning)
597+ to be inward of that [=sticky viewport rectangle=] edge,
598+ insofar as it can while its [=margin box=] remains contained
599+ within its [=containing block=] .
600+
601+ Note: A sticky positioned element with
602+ a non-''auto'' 'top' value and an ''auto'' 'bottom' value
603+ will only ever be pushed down by sticky positioning;
604+ it will never be offset upwards.
605+
606+ Note: Multiple [=sticky positioned=] boxes in the same container
607+ are offset independently,
608+ and therefore might overlap.
626609
627610 Issue: Say what happens if it already overflows the containing block
628611
@@ -633,32 +616,9 @@ Sticky positioning</h3>
633616 Does it involve collapsing between the sticky element and
634617 its descendants, siblings, and/or ancestors?
635618
636- Intersection between the sticky positioned element
637- and the bottom of the [=sticky-constraint rectangle=]
638- limits movement in any direction,
639- so the offset never pushes the sticky positioned element outside of its containing block.
640- However, when the element is free to move within its containing block as the page is scrolled,
641- it appears to be pinned to the relevant flow root edges,
642- similarly to a fixed position element.
643-
644- Note: A sticky positioned element with non-auto 'top' style and auto 'bottom' style
645- will only ever be pushed down by sticky positioning;
646- it will never be offset upwards.
647-
648- Note: Multiple sticky positioned elements in the same container are offset independently.
649- Sticky position offsets may cause them to overlap.
650-
651- Issue: Does the margin on the sticky positioned element affect its distance from the flow root edge?
652-
653- Issue: Sticky positioning should really be defined in terms of the nearest scrollable ancestor,
654- but there is currently no such term defined elsewhere in CSS.
655- CSSOM View refers to "scrolling boxes."
656- CSS Overflow has yet to pull in the relevant text from CSS Box,
657- and CSS Box has an old, confusing definition of "flow root"
658- which is almost (but probably not quite) what we want here.
659- This spec refers to "flow root",
660- since that's the closest thing currently specced somewhere,
661- but this is not optimal.
619+ Issue: Does the margin on the sticky positioned element
620+ affect its distance from the flow root edge?
621+
662622<!-- End section: Sticky positioning -->
663623
664624<h3 id="abs-pos">
0 commit comments