T
Thomas Allen
The value of the width and height attributes of img elements are either a
percentage (like "50%") or they are an integer representing the number of
pixels (like "250").
So this should be an image with a width of 250 pixels and a height of 100
pixels:
<img src="nothing.gif" alt="" width="250" height="100">
In this example, width and height should just be ignored:
<img src="nothing.gif" alt="" width="250px" height="100px">
Based on a little testing, no major browser ignores those values, and
the W3C validator doesn't catch this. I thought that perhaps all non-
digit, non-% chars are stripped when interpreting the attribute.
However when testing CSS1 units in Firefox,
* The units px, pt, pc, in, and mm are interpreted as a unitless value
(interpreted as px)
* em, ex, and cm are completely ignored
Interesting. Looks like I have an excuse to check out the Firefox
source and see how this reflects in the code :^)
Anyway, do you know of any browsers that ignore 'px' for the width
attribute, or of a validator that would note this?
Thomas