W3C home > Mailing lists > Public > www-style@w3.org > January 2013

Re: [css3-values] Interaction of vw/vh and scrollbars

From: Markus Ernst <derernst@gmx.ch>
Date: Thu, 24 Jan 2013 22:22:25 +0100
Message-ID: <5101A611.6080104@gmx.ch>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
CC: www-style list <www-style@w3.org>
Am 24.01.2013 18:59 schrieb Tab Atkins Jr.:
> On Thu, Jan 24, 2013 at 12:15 AM, Markus Ernst <derernst@gmx.ch> wrote:
>> May I humbly suggest the opposite from my author's POV. It seems to me that
>> it would be desirable to have the scrollbar size subtracted when overflow is
>> set to "auto".
>> One main reason to use vw rather than % is to prevent centered designs from
>> "jumping" horizontally when navigating between pages with or without
>> scrollbars.
> Interesting, I wasn't aware of that as a use-case.  (I've always just
> used it for when I want an object to be a fraction of the screen, but
> its direct ancestors aren't all locked to "height:100%; width:100%;".)
>> No authors want their content to be covered by scrollbars, and if authors
>> wanted to force scrollbars, they could also do this using %. So, if vw
>> ignores the scrollbar width when overflow is "auto", authors will end up
>> setting right margins or paddings to prevent the content to be covered by
>> scrollbars, which results in wasting space on devices with other scrolling
>> mechanisms.
> Or they'll set "overflow-y: scroll;" to force a vertical scrollbar,
> which is perfectly acceptable in this circumstance (where different
> pages may be long enough to trigger a scrollbar or not).  Then vw uses
> the adjusted width, while vh continues to do what one would expect and
> fills the screen.

I understand that vh is more intuitive to not reserve space for a scroll 
bar, at least as long as there is none. This applies for vw, too, but 
actually it makes vw pretty useless:
- With overflow:hidden or scroll, it behaves the same as %
- With overflow:auto, it is actually not useable, as width=100vw will 
trigger a horizontal scrollbar if a vertical one occurs.

OTOH, vh is really useful and necessary. In my understanding, it would 
be intuitive and okay for vh to shrink to the scrollbar, if present (as 
we know it from width=100%). Unlike for width, this does not seem to 
have unwanted effects for height, while the suggested behavior for 
overflow:auto seems suboptimal to me, also in the case of vh (it also 
triggers a vertical scrollbar if height=100vh and a horizontal scrollbar 

I am inclined to suggest to totally drop vw in favor of an optimal spec 
for vh.
Received on Thursday, 24 January 2013 21:23:00 UTC

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