Name

MARGINHEIGHT, MARGINWIDTH — NN n/a IE 3 HTML 4

Synopsis

MARGINHEIGHT=”pixelCount"
MARGINWIDTH=”pixelCount"

Optional

Determine the number of pixels between the inner edge of a frame and the content rendered inside the frame. The MARGINHEIGHT attribute controls space along the top and (when scrolled) the bottom edges of a frame; the MARGINWIDTH attribute controls space on the left and right edges of a frame. The HTML 4.0 specification leaves default behavior up to browsers.

Without any prompting, Internet Explorer 4 automatically inserts a margin of 14 (Windows) or 8 (Macintosh) pixels inside a frame. 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. Due to the disparity in default values for each operating system, you cannot assign truly default values to these attributes.

Example

<IFRAME SRC="navbar.html" MARGINHEIGHT=20 MARGINWIDTH=14></IFRAME>

Value

Any positive integer value or zero.

Default

14 (Windows) or 8 (Macintosh).

Object Model Reference

IE

[window.]document.frameName.marginHeight

[window.]document.frameName.marginWidth

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.