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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 3 Dec 2012 15:02:20 -0800
Message-ID: <CAAWBYDAKA-waLB0BTzBpEfMzd5oZdoC5zaur2moqJwFoXRexUQ@mail.gmail.com>
To: www-style list <www-style@w3.org>
Right now the V&U spec doesn't mention anything special about whether
the presence of scrollbars affects the size of the vw/vh units.
Here's a testcase:

<!DOCTYPE html>
<div></div>
<style>
body { margin: 0; overflow: scroll; }
div {
  background: url('http://xanthir.com/pony') no-repeat right top silver;
  width: 100vw; height: 100vh;}
</style>

(Alter the overflow value to get different results.)

In the two browsers that currently support vw/vh, Chrome and IE,
neither one pays any attention to scrollbars.  Regardless of the value
of overflow on <body>, they set the two values to the width/height of
the scrollbar-less viewport.

This seems suboptimal when we *know* that scrollbars will appear, like
if overflow:scroll is set on body.

Should the vw/vh units respond to this, and subtract the size of the
scrollbars from their viewport size?

(In some cases we can't tell, like if <body> is overflow:auto.  In
that case, I think it's reasonable to either always ignore or always
assume scrollbars.  Current behavior in browsers is to always ignore,
so I'm fine with sticking to that.)

~TH
Received on Monday, 3 December 2012 23:03:08 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:03 GMT