July 21, 2005
CSS Height Atrribute
In follow-up to my previous veting about how lame Internet Exploder is, I’ve spent some time in the W3C standards documentation on stylesheets. According to that documentation, here is what the specs are on the height tag as it pertains to stylesheets…
5.5.24 ‘height’
Value:
| auto
Initial: auto
Applies to: block-level and replaced elements
Inherited: no
Percentage values: N/AThis property can be applied to text, but it is most useful with replaced elements such as images. The height is to be enforced by scaling the image if necessary. When scaling, the aspect ratio of the image is preserved if the ‘width’ property is ‘auto’.
Example:
IMG.icon { height: 100px }If the ‘width’ and ‘height’ of a replaced element are both ‘auto’, these properties will be set to the intrinsic dimensions of the element.
If applied to a textual element, the height can be enforced with e.g. a scrollbar.
Negative values are not allowed.
CSS1 core: UAs may ignore the ‘height’ property (i.e., treat it as ‘auto’) if the element is not a replaced element.
So if it’s true that the height percentage value is to be ignored and is only to be read in absoultes, then IE is technically behaving. Sort of. Firefox seems to take a liberty and include the percentage value, perhaps figuring stellar coders like myself actually would have a valid use for a percentage value.
So it seems that perhaps the W3C is being too narrow in the usage of the height tag—considering its usage only for IMG objects. W3C considers it “most useful” in application to images, but I see plenty of validity in application to div tags or tables, in being able to control the relative or absolute height of an item’s attributes.

July 21, 2005, 10:31 am
Filed under: CSS
Leave a Comment
You must be logged in to post a comment.

