W3C home > Mailing lists > Public > www-style@w3.org > April 2005

Re: aspect ratio of box

From: fantasai <fantasai.lists@inkedblade.net>
Date: Sun, 17 Apr 2005 17:01:18 -0400
Message-ID: <4262CE9E.4010704@inkedblade.net>
To: www-style@w3.org

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;


    width: 30%;
    height: twice the width;

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

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:17 UTC