Javascript Reference
Categories: STYLE

javascript STYLE height, width

@March 15, 2008, 1:22 a.m.
height, widthFirefox/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.

Dear gakaa.com webmaster, Thanks for the valuable information!
Shirleen Eastham - 1 weeks
atorvastatin 40mg brand <a href="https://lipiws.top/">order lipitor 80mg pills</a> cheap atorvastatin 10mg
Lnkcnu - 10 months
I have used getelementsbyid for iframe but its not effecting the iframe value. what coul be the reason?
Qaiser - 2011-03-14

Powered by Linode.