You are here: Reference > JavaScript > client-side > HTML DOM > properties > height (embed, iframe, img, table, ...)
height property (embed, iframe, img, table, ...)
Specifies or returns the height of an element.
This property is deprecated. Use the height style property instead.
Syntax:
You can find the related objects in the Supported by objects section below.
HTML page for this property: height |
Possible values:
Sets or retrieves the height of the object.
One of the following values:
Integer that specifies the height of the object, in pixels. | |||||||
Integer in the range 0-100 followed by a %. |
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the height attribute:
|
||||
<img id="myImage" src="picture.gif" height="100px" width="100px" /> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 2:
Recommendation:
|
||||
<img id="myImage" src="picture.gif" style="height:100px; width:100px;" /> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 3:
This example illustrates the use of the height property:
|
||||
<head> <script type="text/javascript"> function SetHeight () { var image = document.getElementById ("myImage"); var input = document.getElementById ("myInput"); image.height = input.value; } </script> </head> <body> <img id="myImage" src="picture.gif" height="100px" width="100px" /> <input id="myInput" type="text" value="50" /> <button onclick="SetHeight ();">Set image height!</button> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
External links:
height (MSDN)
height (Safari Reference Library)
height (IFRAME) (W3C)
height (TH) (W3C)
height (IMG) (W3C)
height (APLLET) (W3C)
height (Safari Reference Library)
height (IFRAME) (W3C)
height (TH) (W3C)
height (IMG) (W3C)
height (APLLET) (W3C)
User Contributed Comments