Alternative to Sticky Positioning

I've got an alternative idea for the problem that Sticky Positioning[1] 
is trying to solve. I think it can potentially solve more use cases than 
just this one.

What if we had a pseudo-class that matched elements based on whether 
they are inside the viewport or not? Then you could give the element a 
position: fixed when it is not. Like this:

[role=navigation]:viewport-partially-hidden {
     position: fixed;
     top: 0;
     left: 0;
}

Obviously, I'm bad in naming pseudo-classes, but you get the gist.

It could also take an argument, like which part of the element is hidden 
(to stick something to the top/bottom of the viewport).

What do you think?

[1] http://lists.w3.org/Archives/Public/www-style/2012Jun/0627.html

Received on Wednesday, 7 November 2012 15:19:32 UTC