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

"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