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

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

From: josh on <josh@theyrule.net>
Date: Tue, 15 Mar 2016 18:02:00 +0000
Message-ID: <CAHhdfkU69xMVHh8jR0hneCn8b=MJiM403PmCYMjCeN=Q_xed1w@mail.gmail.com>
To: Xidorn Quan <quanxunzhen@gmail.com>, josh on <josh@theyrule.net>
Cc: "www-style@w3.org" <www-style@w3.org>
"This won't work in general, as it introduces cyclic dependency. The
dimensions of a parent could be affected by its descendants."

Is that not the same as the percent unit?
http://codepen.io/joshon/pen/PNbaaY
Could it not be handled in the same way?

I am probably missing something here.

Josh


On Mon, Mar 14, 2016 at 7:49 PM Xidorn Quan <quanxunzhen@gmail.com> wrote:

> 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 18:02:39 UTC

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