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

Le 04/12/2012 19:04, Boris Zbarsky a écrit :
> On 12/4/12 1:00 PM, Sylvain Galineau wrote:
>> # The 'width' media feature describes the width of the
>> # targeted display area of the output device. For continuous media,
>> # this is the width of the viewport (as described by CSS2, section 9.1.1 [CSS21])
>> # including the size of a rendered scroll bar (if any).
>
> Awesome....
>
> So CSS21 9.1.1 and media queries use one definition of "viewport" while
> CSS21 10.1 uses a different one, apparently.  Quite lovely.
>
>> I think it would also be weird for vh/vw units to react to the presence of a
>> scrollbar while MQ still considers the viewport width to be the same.
>
> Yeah.  Seems like we can't avoid weird no matter what we do here, as
> long as UAs don't always show viewport scrollbars....


I don’t know why it was decided that "the viewport" for the purpose of 
Media Queries should include the scrollbars, but I think it’s clear that 
the initial containing block (the one referred to by :root{width:100%} ) 
doesn’t (on UAs where scrollbars are not overlaid but "take up" some space.)

I also think that it’s more important to make `width: 100vw` the same as 
`width: 100%` on the root (ie. the ICB) than it is to make it the same 
as the `width` media query. This is clearly the intended meaning in 
css3-values:

> vw unit
>     Equal to 1% of the width of the initial containing block.


Therefore I suggest changing this sentence of css3-values:

> When the height or width of the viewport is changed, they are scaled
> accordingly.

to

> When the height or width of the initial containing block is changed,
> they are scaled accordingly.

in order to remove any doubt. "viewport" would only be mentioned in 
"viewport-percentage lengths" because icbw/icbh/icbmin/icbmax suck as 
unit names.

Cheers,
-- 
Simon Sapin

Received on Wednesday, 5 December 2012 12:11:06 UTC