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

Re: [css3] "keep aspect ratio" feature

From: Christoph Päper <christoph.paeper@crissov.de>
Date: Mon, 24 Nov 2008 21:26:23 +0100
Message-Id: <421A4946-FE29-49C9-BFD1-C1E8E0505D48@crissov.de>
To: www-style <www-style@w3.org>

Andrew Fedoniouk:
> Time to time I am getting feature request to provide "keep aspect  
> ratio" functionality in CSS.
>
> To declare function 'width(NN%)' that can be used as a value of  
> height, min-height, max-height CSS attributes.
>
> #my-golden-ratio {
>   width: 30%;
>   height: width(62%);
> }

Why would you make either width or height depend on the other when  
you really want to provide their ratio (or area, i.e. either the  
result of their division or their multiplication)?

   foo {
     ratio: calc(4/3); /* ignored if contradicting explicit width/ 
height,
                          because it is not needed then */
     width: 4cm;
     height: auto; /* -> 3cm */
   }

   foo {
     area: 12cm; /* _square_ centimetres actually, but we only need  
the scale,
                    the power is encoded in the property */
     width: 4cm;
     height: auto; /* -> 3cm */
   }
Received on Monday, 24 November 2008 20:26:38 GMT

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