W3C home > Mailing lists > Public > www-style@w3.org > November 2008

Re: [css3] "keep aspect ratio" feature

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Thu, 20 Nov 2008 23:50:51 -0800
Message-ID: <4926685B.8080602@terrainformatica.com>
To: Zack Weinberg <zweinberg@mozilla.com>
CC: W3C Emailing list for WWW Style <www-style@w3.org>

Zack Weinberg wrote:
> Andrew Fedoniouk <news@terrainformatica.com> wrote:
>> Time to time I am getting feature request to provide
>> "keep aspect ratio" functionality in CSS.
> ....
>> #my-golden-ratio
>> {
>>    width: 30%;
>>    height: width(62%);
>> }
>>
>> where width takes 30% of content box of #my-golden-ratio parent
>> and height of the element will be set to 62% of its computed width.
> 
> Not a completely crazy idea, but you'd ultimately end up with one of
> these functions for every length property.  I think it'd be better to
> generalize immediately: prop('name') which evaluates to the computed
> value of the property named 'name', and can be used inside calc().

Well, there are not so many length properties that you can
or makes sense to use this way.

About prop(name)/calc()

Consider this:

height: calc( prop(height)*1.2 );

or

box-sizing: border;
    padding: calc( prop(height)*0.1 );

there are a lot of other funny things with the calc() used this
way that may cause even oscillations.

calc() gives an impression of flexibility but it
is very limited feature indeed.

-- 
Andrew Fedoniouk.

http://terrainformatica.com
Received on Friday, 21 November 2008 07:51:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:17 GMT