W3C home > Mailing lists > Public > www-style@w3.org > September 2015

Re: [css-position]: What about min-top, min-left, min-right, min-bottom?

From: Daniel Tan <lists@novalistic.com>
Date: Thu, 17 Sep 2015 02:18:33 +0800
Message-ID: <55F9B279.6030008@novalistic.com>
To: Axel Dahmen <brille1@hotmail.com>, www-style@w3.org
On 9/17/2015 2:12 AM, Axel Dahmen wrote:
> I regularly get a request to write headers, navigation or advertisement
> elements which are supposed to scroll with the page but are supposed to
> get fixed to the viewport as soon as a certain limit to the viewport has
> been reached.
> There are a number of webpages implementing exactly this behaviour. But
> they all are using JavaScript to get this implemented.
> I have seen many questions on corresponding "min-top" and similar CSS
> properties on StackExchange, but I didn't find discussions here.
> What is the opinion of the workgroup about adding properties like
> min-top, min-left, min-right, min-bottom to the specification which
> would switch the corresponding element's position value from
> static/relative/absolute to fixed in regard to the corresponding axis as
> soon as its computed position reaches a minimum distance to one of the
> viewport borders?
> Thanks for enlightening me.
> Cheers,
> Axel

This will be addressed with position: sticky[1]. You specify an offset, 
and position: sticky ensures the element always stays offset from the 
viewport by at least that amount, until/unless it can no longer fit its 
containing block in that position (an oversimplification, but you get 
the idea).

[1]: https://drafts.csswg.org/css-position/#sticky-pos

Daniel Tan
Received on Wednesday, 16 September 2015 18:19:06 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:57 UTC