Javascript Reference
Categories: FRAME

javascript FRAME marginHeight, marginWidth

@March 15, 2008, 1:22 a.m.
marginHeight, marginWidthFirefox/Netscape/NN 6 IE 4 Chrome/Safari/DOM 1  

Read/Write  

Indicate the number of pixels between the inner edge of a frame and the content rendered inside the frame. The marginHeight property controls space along the top and (when scrolled) bottom edges of a frame; the marginWidth attribute controls space on the left and right edges of a frame.

 

Without any prompting, browsers automatically insert a small margin inside a frame (generally between 8 and 14 pixels depending on browser and operating system). But if you attempt to override the default behavior, be aware that setting any one of these two attributes causes the value of the other to go to zero. Therefore, unless you want the content to be absolutely flush with various frame edges, you need to assign values to both attributes.

 
Example
 
parent.document.getElementById("myFrame").marginHeight = 14;
parent.document.getElementById("myFrame").marginWidth = 5;
 
Value

Positive integer value or zero.

 
Default

Varies with browser and operating system.


Powered by Linode.