Re: [css3] "keep aspect ratio" feature

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 UTC