Re: specifying position:sticky

Le 13/07/2013 04:25, Robert O'Callahan a écrit :
> On Fri, Jul 12, 2013 at 4:48 PM, Corey Ford <cford@mozilla.com
> <mailto:cford@mozilla.com>> wrote:
>
>     On 7/12/13 9:37 AM, Corey Ford wrote:
>
>         For any of 'top', 'bottom', 'left', and 'right' that are not
>         'auto', if the box's normal position would cause that edge of
>         its margin box to be less than the specified distance within
>         that paddingedge of its scrolling container, the box is
>         repositioned to that distance from the edge, such that the box
>         doesnot move while the container scrolls. The distance the box
>         is repositioned is limited such that the element's margin box
>         never crosses the oppositeedge of the content box of its
>         containing block, with the effect thatthe element starts
>         scrolling with its container again when it reaches the end of
>         its containing block.
>
>     For sticky elements that generate multiple boxes, there are several
>     options for what exactly to keep contained inside the containing
>     block / viewport. WebKit appears to keep the farthest edges in each
>     direction contained, which seems sensible (similar to how the
>     containing block for position:center is established in the current
>     css3-positioning draft).
>
>
> That sounds good, but there is one remaining issue: when the containing
> block element of the position:sticky element itself has broken into
> multiple boxes. E.g.
> <div style="column-height:100px">
>    <div id="containing-block">
>      <div style="position:sticky; height:200px"></div>
> I'm not sure what you should do there. I don't remember whether we
> decided to define "containing block" to denote an element or a
> particular box.

I my mental model, a containing block is a rectangle that is most often 
based on a CSS box. Elements do not have containing blocks, each 
fragment (box) does. Fragments generated by the same element can have 
different containing blocks, for example based on different column boxes 
of the same multicol element.

(The spec is unclear on this, with the general confusion in 2.1 between 
boxes and elements. Other people may have a different reading.)

Given how this definition of `position: sticky` is based on in-flow (and 
fragmented) layout, I’d say that each fragment should be positioned 
independently, within its own containing block.

-- 
Simon Sapin

Received on Saturday, 13 July 2013 09:17:28 UTC