Name

height — NN 4 IE 4 CSS 1

Synopsis

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 ...

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.