W3C home > Mailing lists > Public > www-style@w3.org > March 2016

Re: Aspect ratio proposal: new units %w and %h

From: Xidorn Quan <quanxunzhen@gmail.com>
Date: Tue, 15 Mar 2016 10:49:17 +0800
Message-ID: <CAMdq69-wV_pnXRGx_9LiiW1pAEC6z_MQiaeRmcGwwTnwqVXWBw@mail.gmail.com>
To: josh on <josh@theyrule.net>
Cc: "www-style@w3.org" <www-style@w3.org>
On Tue, Mar 15, 2016 at 6:21 AM, josh on <josh@theyrule.net> wrote:

> Proposed solution:
> %w, %h
> Where 50%w is 50% of the offsetWidth of the offsetParent, and 50%h is 50%
> of the offsetHeight of the offsetParent.
>
> To maintain a div at 16:9 you could use the style:
>
> .video-wrap {
>   width: 100%w;
>   height: 56.25%w;
>   max-width: 177%h;
>   max-height: 100%h;
> }
>
> I hope this is a helpful contribution, my apologies if it is not.
>

This won't work in general, as it introduces cyclic dependency. The
dimensions of a parent could be affected by its descendants.

It could probably work if the "parent" has layout containment.

Do we have a concept for elements with layout containment? Probably we
could call it layout container or something?

- Xidorn
Received on Tuesday, 15 March 2016 02:50:26 UTC

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