[whatwg] require img dimensions to be correct?

Ian Hickson ian at hixie.ch
Tue Jul 29 19:45:20 PDT 2008


On Wed, 21 Mar 2007, Henri Sivonen wrote:
> 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 styles.
> 
> 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.

I buy this for pixels. I don't buy it for percentages. The arguments don't 
apply to those. If you're using percentages, then the values aren't 
dependent on the image, and you should do it in the medium-specific style 
sheet. IMHO.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list