W3C home > Mailing lists > Public > www-style@w3.org > June 2012

Re: Sticky Positioning

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 27 Jun 2012 16:01:19 -0700
Message-ID: <CAAWBYDDo-rovtKithN=LAtZajhu8iM8R1unYjrfY0BghsBijYw@mail.gmail.com>
To: "Edward O'Connor" <eoconnor@apple.com>
Cc: www-style@w3.org
On Wed, Jun 27, 2012 at 10:32 AM, Edward O'Connor <eoconnor@apple.com> wrote:
>> I think http://www.xanthir.com/blog/b48H0 addresses the same problem
>> more generally.
> The solution in Tab's blog post solves ALL THE PROBLEMS; it is
> essentially a Grand Unified Theory for positioning. Which is
> interesting, and definitely worth pursuing. But just because we *could*
> describe a positioning value in terms of such a Grand Unified Theory
> doesn't mean that we shouldn't make incremental improvements to the
> platform now, and add such generalized features later when they're more
> baked.

Ignore the first part of that blog post.  Just look at the end, the
"Containing the Positioned Element" section.  This bit is carveable
from the rest of the proposal, and solves stickypos in a pretty simple

If you want a heading that sticks when it gets within 10px of the top
of the screen, make it "position: fixed; position-contain: parent;
top: 10px;".  Or, alternately, "margin-top: 10px; position: relative;
position-contain: viewport;"

This isn't perfect - since it's fixed, it won't scroll left/right.
The problem is caused by the fact that you want it to be fixed
vertically but relative horizontally.  We should fix that generally -
that's the first part of my blog post.

Received on Wednesday, 27 June 2012 23:02:10 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:00 UTC