[whatwg] require img dimensions to be correct?

Henri Sivonen hsivonen at iki.fi
Wed Mar 21 02:37:05 PDT 2007

On Mar 3, 2007, at 21:58, Ian Hickson wrote:

> The question isn't whether or not you should have the ability to scale
> images; it's clear that this is desirable. The question is whether it
> makes sense to put this in HTML as opposed to CSS. Why would HTML  
> be the
> place to put this?

Because the dimensions vary from image to image, putting the  
dimensions in an external style sheet would mean moving the  
dimensions even further away from the images they pertain to. Generic  
reusable styles make sense in an external sheet. ID selectors  
specific to particular image files don't. OTOH, moving the dimensions  
from attributes to style='' or <style> within the HTML file is  
totally pointless from any *practical* point of view and would make  
it harder to implement structural HTML editors that don't tamper with  

As for requiring pixel dimensions to be "correct": No, it shouldn't  
be required, because for backwards compat the <img> width and height  
are in CSS pixels and image dimensions are in real pixels. With  
emerging high-res displays it may soon make sense to have bitmaps  
whose bitmap pixels are smaller than CSS pixels.

As for allowing percentages: Yes, they should be allowed. Percentages  
have to be implemented for backwards compat anyway, so pretending  
that they aren't there doesn't have a practical advantage when  
(considering the above) the attributes themselves should stay.

> If we put this in HTML, how can we still drop <font>, <table  
> border>, <td width>, etc?

Those aren't generally tightly coupled with something like the shape  
of a particular image file. (OTOH, the left/right alignment of table  
cells *is* often tightly coupled with the cell data, which suggests  
that the cell alignment attributes should not be dropped.)

Henri Sivonen
hsivonen at iki.fi

More information about the whatwg mailing list