javascript STYLE height, width
height, width | Firefox/Netscape/NN 6 IE 4 Chrome/Safari/DOM 2 |
Read/Write | |
Indicate the height and width (and their units) of the element. Because the values are strings containing the assigned units, you cannot use these properties for calculation. Grab copies of the numbers by using parseFloat( ) on the values; or for IE, use pixelHeight, pixelWidth, posHeight, and posWidth properties. Changes to these properties may not be visible unless the element has its position style attribute set. |
|
In IE 6 standards compatibility mode (where document.compatType == "CSS1Compat"), these dimensions apply to only the content portion of an element, irrespective of borders, padding, or margins. For example, if a positioned element that is equipped with padding and borders must be sized to a precise rectangular size, you must subtract the thicknesses of the padding and borders from the height and width values so that the overall element is the desired size. |
|
Example | |
document.getElementById("viewArea").style.height = "450px"; |
|
Value | |
String consisting of a numeric value and length measure or percentage. |
|
Default | |
None. |
Powered by Linode.