height | NN 4 IE 4 CSS 1
| Inherited: No
Sets the height of a block-level element's content height (exclusive of borders, padding, and margins). Version 4 browsers apply the height attribute only to selected elements (IE 4) and absolute-positioned elements (which means DIV wrappers around other types of elements), but CSS2 recommends application to all replaceable elements as well. For absolute-positioned elements, Navigator 4 and Internet Explorer 4 react differently to settings of the height style attribute. They agree on one thing: if the content requires more height than is specified for the attribute, the content requirements override the attribute value (use the clipping region to truncate the height of the viewport for the element if you need to). But if the height attribute value produces a box that is taller than the content requires, the browsers behave differently. Navigator cinches up the height of the box to accommodate the content (as if the height attribute is perennially set to auto), unless you also adjust the clipping rectangle; Internet Explorer retains the attribute height. This discrepancy can affect the look of borders around an absolute-positioned element generated via CSS syntax.
CSS Syntax height: length | percentage | auto
JavaScript Equivalent height
Value See the discussion about length values at the beginning of this chapter. You may also specify a percentage value, which is calculated based on the height of the next outermost container. The setting of auto lets the browser determine the height of the element box based on the amount of space required to display the content.
Initial Value auto
Example DIV#announce {height: 240} TEXTAREA {height: 90%}
Applies To Navigator 4: all absolute-positioned elements. Internet Explorer 4: APPLET, DIV, EMBED, FIELDSET, HR, IFRAME, IMG, INPUT, MARQUEE, OBJECT, SPAN, TABLE, and TEXTAREA elements. CSS2: all elements except nonreplaced inline elements, table column elements, and column group elements.
Object Model Reference
IE | [window.]document.all.elementID.style.height