home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

HTML 4.0 Sourcebook
(Publisher: John Wiley & Sons, Inc.)
Author(s): Ian S. Graham
ISBN: 0471257249
Publication Date: 04/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


IFRAME Element: A Floating FRAME (Internet Explorer Only)

Usage: <IFRAME> ... </IFRAME>
Can Contain: ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, DL, FIELDSET, FORM, Hn, HR, [ISINDEX], MENU, MULTICOL, NOEMBED, NOFRAMES, NOLAYER, NOSCRIPT, OL, P, PRE, TABLE, UL, characters, character highlighting, A, APPLET, BASEFONT, BR, BUTTON, EMBED, IFRAME, LAYER, IMG, INPUT, KEYGEN, LABEL, LAYER, MAP, OBJECT, SCRIPT, SELECT, SPACER, TEXTAREA, WBR
Can Be Inside: BLOCKQUOTE, BODY, CENTER, DD, DIV, FIELDSET, FORM, MULTICOL, NOEMBED, NOFRAMES, NOSCRIPT, TD, TH, character highlighting, A, APPLET, BUTTON, IFRAME, LABEL, LEGEND, OBJECT
Attributes: CLASS, ID, STYLE, TITLE, (onBlur, onFocus: Internet Explorer 4 only)
ALIGN, FRAMEBORDER, HEIGHT, HSPACE, MARGINHEIGHT, MARGINWIDTH, NAME, SCROLLING, SRC, VSPACE, WIDTH

After Netscape introduced frameset documents, Microsoft introduced additional markup for floating frames. A floating frame is just that: a frame that can float anywhere inside an HTML document. Thus, IFRAME is placed inside the regular document BODY and, in a sense, acts like an embedded object or image. Figures 7.9 and 7.10 illustrate such an IFRAME.

The content of a floating frame is specified by an SRC attribute. The attributes FRAMEBORDER, MARGINWIDTH, MARGINHEIGHT, NORESIZE, and SCROLLING define the physical properties of the frame, while HEIGHT and WIDTH define the size, and ALIGN the alignment on the display. The NAME attribute assigns a specific name to the FRAME, which allows the frame to be targeted (using the TARGET attribute) by A or FORM elements.

The CLASS, ID, and STYLE attributes can be used to assign style sheet formatting rules to the element. Note that these rules only affect the layout and formatting of the element on the page and do not affect the formatting of the document referenced by IFRAME.

The content of an IFRAME element is alternative markup, displayed by browsers that do not understand IFRAME. Since Netscape Navigator does not understand IFRAME, it is always a good idea to include content inside this element. Figure 7.11 shows the rendering of the document listed in Figure 7.9 by an IFRAME-incapable browser.


Figure 7.9 An example document illustrating the use of the IFRAME element. Figures 7.10 and 7.11 show the rendering of this document by Internet Explorer 3 and Netscape Navigator 3, respectively.

<HTML>
<HEAD><TITLE>Test of Microsoft IFRAME</TITLE></HEAD>
<BODY>
<H2>A Test of Microsoft's IFRAME</H2>
This is not a terribly exciting example -- which is 
not suprising, given that I am writing this at 
around 2:30AM, afterapproximately 14 hours at the 
computer. Book writing seems to take forever.... 
<IFRAME  SRC=“dogs.html” BORDER=“20”
         FRAMEBORDER=“1” ALIGN=“left”
         WIDTH=“350” HEIGHT=“200”> 
<HR NOSHADE>
<H3>Alternative Content</H3>
Ok, So you don't understand <B>IFRAME</B>. Well, this
block of text is for you!
<HR NOSHADE>
</IFRAME>
</DIV>
<P> Writing a book is a slow process, much slower than I 
first expected -- there are always small things to do,
such as correcting Figure numberings, checking spelling, or
fixing poor wordings and explanations. The truth, however
is that most writers <em>enjoy</em> this process.
Perhaps 14 hours at a stretch is a bit too much -- and I will 
admit that I would prefer less onerous hours (a publisher's 
deadline does tend to focus one's efforts) -- but I do enjoy 
the process, and feel great satisfaction at producing 
informative, readable, and accurate prose.
</BODY>
</HTML>


Figure 7.10  Internet Explorer 3 rendering of the document illustrated in Figure 7.9. Note how the IFRAME is left-aligned with surrounding text flow, just as if it were an embedded image.

Currently, only Internet Explorer supports IFRAME. The attributes are:

ALIGN=“top,” “middle,” “bottom,” “left,” “right” (optional) Specifies the alignment for the floating frame on the page. The meanings are the same as for the IMG element. The values “left” and “right” produce floating frames. The default value is “bottom.”
FRAMEBORDER=“1,” “0” (optional) Sets the display mode for the floating frame border. The value “1” (the default) creates borders with a three-dimensional effect, while “0” produces no borders.
HEIGHT=“number,” “number%” (optional: must be specified if WIDTH is specified) Specifies the height of the displayed floating frame, either in pixels or as a percentage of the available window height. If HEIGHT is specified, then WIDTH must also be specified, otherwise Internet Explorer will improperly display the document.


NOTE: You must specify both HEIGHT and WIDTH

If you specify a floating frame WIDTH, you must specify a HEIGHT.


HSPACE=“number” (optional) Specifies a spacing margin, in pixels, to leave to the left and right of the floating frame. The default margin is zero pixels. This is only relevant for “left” and “right” aligned frames.
LONGDESC=“string” (optional; not currently implemented) Specifies a long text description of the frame. This is intended for use by text-only or nongraphical browsers, and to supplement the value of TITLE. Support for this attribute is not implement on current browsers.


Figure 7.11  Netscape Navigator 3 rendering of the document illustrated in Figure 7.9. Navigator does not understand the IFRAME element, and instead displays the alternate content contained inside the IFRAME.

MARGINHEIGHT=“number” (optional) Specifies the height, in pixels, of the top and bottom margins within the frame: The default value is approximately 10 and is browser-specific. MARGINHEIGHT cannot be less than 1, to ensure that there is some blank space left between the frame content and the frame borders. If this attribute is absent, the browser will itself determine a (hopefully) appropriate margin height.
MARGINWIDTH=“number” (optional) Specifies the width, in pixels, of the left and right margins within the frame: The default value is approximately 10 and is browser-specific. MARGINWIDTH cannot be less than 1, to ensure that there is some blank space left between the frame content and the frame borders. If this attribute is absent, the browser will hopefully determine an appropriate margin width.
NAME=“name” (optional)Assigns a symbolic name to the particular frame: The TARGET attribute of a FORM or A element can then direct retrieved documents or data to this named frame. If NAME is absent, the frame name is undefined. Values for names must be name tokens, as defined previously.
SCROLLING=“yes,” “no,” “auto” (optional) Specifies the status of scrollbars for the frame. A value of “yes” means that the frame must always have scrollbars, while “no” means that the frame should never have scrollbars. If you use this latter value, you must be sure that the frame is large enough to contain the desired document. The value “auto” lets the browser include scrollbars when necessary. The default value is “auto.”
SRC=“url” (optional) Specifies the URL of the HTML document to be displayed within the frame. SRC can be absent—in which case the frame is initially blank.
VSPACE=“number” (optional) Specifies a spacing margin, in pixels, to leave above and below the floating frame. This is only relevant for “left” and “right” aligned frames. The default margin for floating frames is zero pixels.
WIDTH=“number” (optional: must be specified if HEIGHT is specified) Specifies the width of the displayed floating frame, either in pixels, or as a percentage of the available window width. If WIDTH is specified, then HEIGHT must also be specified, otherwise Internet Explorer will improperly render the document.


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.