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

Re: vh and vw as units for dimensions.

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 28 May 2013 06:59:53 -0700
Message-ID: <CAAWBYDCyLX_MFU_5JBbR3Q7M8eRbekwftpU5BrpM=pFY7dxXyQ@mail.gmail.com>
To: irfan mir <theirf@gmail.com>
Cc: www-style list <www-style@w3.org>
On Tue, May 28, 2013 at 6:28 AM, irfan mir <theirf@gmail.com> wrote:
> I just learned about the vh and vw units and see how it would be very
> helpful in terms of typography.
>
> But in terms of using it as a unit for dimensions, what differentiates vh
> for height and vw for width from percent?
> Don't a 100 of all 3 take up the entire viewport?

As Henrik said, percentages are only equal to vw/vh on the html/body
elements, and on other elements if *every ancestor was 100%
width/height as well*.

That's obviously rarely true, so vw/vh let you use the viewport size
deeper into your page structure.

It also works for things where percentages are interpreted
differently, like font-size (where they're relative to the parent's
font-size).

~TJ
Received on Tuesday, 28 May 2013 14:00:48 UTC

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