EN
Dieser Inhalt ist in Ihrer Sprache leider nicht verfügbar. Im Folgenden finden Sie die englische Version.

height property

Sets or retrieves the height of the object.

Syntax

height: height | percentage | auto

Property values

auto

Default.  

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

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.

CSS information

Applies ToAll elements
Mediavisual
Inheritedno
Initial Value

Remarks

If you specify the height property of an img object but not the 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 pixelHeight or posHeight.

Examples

This example uses an inline style sheet to set the height of an image to 4 centimeters.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/height_h.htm


<img src="sphere.jpg" style="height: 4cm">

This example uses inline scripting to change the height of an image when an onclick event occurs.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/height_s.htm


<button onclick="height1.style.height='1cm'">Shrink sphere</button>

See also

CSSStyleDeclaration
currentStyle
runtimeStyle
style

 

 

Anzeigen:
© 2014 Microsoft