Re: aspect ratio of box

Ian Hickson wrote:
> On Sun, 17 Apr 2005, Barry wrote:
> 
>>Instead of determining the ratio, I'd like something like:
>>
>>img { width: 30%; OrigWidth: 100px; OrigHeight: 100px; }
>>
>>No math necessary. Just look at the image properties for Orig height and 
>>width and make CSS preserve the aspect ratio when width is a percentage.
> 
> The original dimensions are a markup-level concern. You can already do the 
> above, just use height and width attributes in HTML.

IIRC, the width and height attributes in HTML just set the corresponding
height and width values in CSS. They don't say anything about the intrinsic
size or aspect ratio. So, for the example given,

    <img src=".." width="100" height="200" style="width: 30%">

would result in following cascaded values:

    width: 30%;
    height: 200px;

not

    width: 30%;
    height: twice the width;

~fantasai

Received on Sunday, 17 April 2005 21:01:32 UTC