Re: Image width specification in html5

What Simon Linked to:

"The width and height attributes on applet, embed, iframe, img, object or video elements, and input elements with a type attribute in the Image Button state, map to the dimension properties 'width' and 'height' on the element respectively."

"When the text below says that an attribute attribute on an element element maps to the dimension property (or properties) properties, it means that if element has an attribute attribute set, and parsing that attribute's value using the rules for parsing dimension values doesn't generate an error, then the user agent is expected to use the parsed dimension as the value for a presentational hint for properties, with the value given as a pixel length if the dimension was an integer, and with the value given as a percentage if the dimension was a percentage."

"The rules for parsing dimension values are as given in the following algorithm. When invoked, the steps must be followed in the order given, aborting at the first step that returns a value. This algorithm will return either a number greater than or equal to 1.0, or an error; if a number is returned, then it is further categorized as either a percentage or a length."

There is a note on the preceeding paragraph stating it is Ready for first Implementations and that is dated 10/23/2009

"Some rules are intended for the author-level zero-specificity presentational hints part of the CSS cascade; these are explicitly called out as presentational hints."

"When an img element is available, it provides a paint source whose width is the image's intrinsic width, whose height is the image's intrinsic height, and whose appearance is the intrinsic appearance of the image."

So, it seems img's width and height being "intrinsic values" are meant to tell the browser what the actual width and height of the specified image is UNLESS the type attribute is set to ImageButton in which case percentage will be used but the image will be a button.

However, the paint source is CSS-able and therefore you can scale the image via CSS.

I'm not sure whether I want to be right about that or not. Being right means I read and followed the spec and that can't be healthy ;).  If I got it wrong please forgive me I can only read English fluidly ;)

Art C.
 

Received on Monday, 21 November 2011 10:09:52 UTC