Partager via


height property

Sets or retrieves the height of the object.

Syntax

Integer value = object.put_height(Variant v);Integer value = object.get_height(Variant* sHeight);

Property values

Type: VARIANT

auto (auto)

Default.  

height (height)

Floating-point number followed by an absolute units designator (cm, mm, in, pt, or pc) or a relative units designator (em, ex, or px). For more information about the supported length units, see CSS Values and Units Reference.

percentage (percentage)

Integer followed by a percent sign (%). The value is a percentage of the height of the parent object, which must be specified explicitly. Negative values are not allowed.

String format

height | percentage | auto

CSS information

Applies To All elements
Media visual
Inherited no
Initial Value

Remarks

If you specify the IHTMLCurrentStyle::height property of an img object but not the IHTMLCurrentStyle::width property, the width is proportional to the height according to the dimensions of the image source file.

To perform operations on the numeric value of this property, use IHTMLStyle::pixelHeight or IHTMLStyle::posHeight.

As of Microsoft Internet Explorer 6, when you use the !DOCTYPE declaration to specify standards-compliant mode, this property specifies the distance between the top and bottom edges of the content box—that is, within the IHTMLCurrentStyle::padding.

When the !DOCTYPE declaration does not specify standards-compliant mode, and with earlier versions of Windows Internet Explorer, this property includes the object's content box, plus the values of the following properties: IHTMLRuleStyle::borderTop, IHTMLRuleStyle::borderBottom, IHTMLCurrentStyle::paddingTop, and IHTMLCurrentStyle::paddingBottom. Subtracting the sum of the values of these properties from the value of the IHTMLCurrentStyle::height property equals the height of the parent object's content box.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll

See also

Conceptual

Measuring Element Dimension and Location with CSSOM in Internet Explorer 9

Other Resources

CSS Enhancements in Internet Explorer 6