W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2006

[whatwg] <img> element comments

From: Greg Kilwein <gkilwein@fbsdata.com>
Date: Tue, 07 Nov 2006 13:28:49 -0600
Message-ID: <4550DE71.30702@fbsdata.com>
Andreyka Lechev wrote:
> On 07.11.2006, at 19:49, Shadow2531 wrote:
>> On 11/7/06, Anne van Kesteren <fora at annevankesteren.nl> wrote:
>>> I thought the proposal was that only that (setting height and width 
>>> to the
>>> intrinsic size of the image) would be conforming, but that rendering 
>>> would
>>> still be the same.
>> [encouraged if you need to resize the image - alt]
>> <img src="276x110.png" style="width: 50%; height: 50%;" width="276"
>> height="110" alt="fallback text" title="description">
>>
>> If that's correct, doing things the proposed, encouraged, conforming
>> way seems fine as far as UAs that support css are concerned.
> Don't forget that percentage values are relative values. And in 
> current browser implementations, setting those values via CSS-rules or 
> using width- and height-attributes are leading to different results! 
> It's due to different parents to calculate actual (pixel) values from!
Also, if only one of either the "width" or "height" attributes is set, 
some browsers will scale the other dimension automatically.  Consider 
this example:

<img src="100x50.png" width="50">

Some browsers will scale height to be 25 in this instance, given an 
image with a width of 100 pixels and a height of 50 pixels.  This is 
quite useful when the height or width of an image needs to be fixed 
without distorting the aspect ratio.

--
Greg Kilwein
gkilwein at fbsdata.com
Received on Tuesday, 7 November 2006 11:28:49 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:49 UTC