<IFRAME ...>

Usage Recommendation
Use it, but be particularly careful to include options for the many people whose browsers don't do inline frames.

  • SRC: URL of the document to go in the frame
  • HEIGHT: height of the inline frame
  • WIDTH: width of the inline frame
  • NAME: name of this inline frame
  • LONGDESC: URL of a long description of the contents of the frame
  • FRAMEBORDER: if the frame should have a border around it
 
  • MARGINWIDTH: internal left/right margin for the frame
  • MARGINHEIGHT: internal top/bottom margin for the frame
  • SCROLLING: if the frame should have scroll bars
  • ALIGN: alignment of the frame object to text around it
  • VSPACE: space above and below the frame
  • HSPACE: space to the left and right of the frame

<IFRAME ...> is an HTML 4.0 addition to the frames toolbox. Currently only MSIE supports <IFRAME ...>.

Unlike frames created using <FRAMESET ...> and <FRAME ...>, <IFRAME ...> creates a frame that sits in the middle of a regular non-framed web page. <IFRAME ...> works like <IMG ...>, only instead of putting a picture on the page, it puts another web page.

For example, within the same directory as this page there is a file called "hello.html". This code puts hello.html into an inline frame:

<IFRAME SRC="hello.html" WIDTH=450 HEIGHT=100>
If you can see this, your browser doesn't 
understand IFRAME.  However, we'll still 
<A HREF="hello.html">link</A> 
you to the file.
</IFRAME>

which gives us this inline frame:

Here's what the code means:

IFRAME
The name of the <IFRAME ...> tag

SRC="hello.html"
The URL of the document to show in the inline frame.

WIDTH=450 HEIGHT=100
The dimensions of the inline frame.

If you can see this, your browser doesn't understand IFRAME. However, we'll still <A HREF="hello.html">link</A> you to the file.
Code between <IFRAME ...> and </IFRAME> is not displayed by browsers that understand <IFRAME ...>. Browsers that do not understand <IFRAME ...> will display this code (because they don't know to ignore it).

You can do most of the things with <IFRAME ...> that you can do with regular frames, including set the frame border, set internal margins, and set if there are scroll bars. You can use the attribute so that you can set links to target the frame.

You can also control a few settings similar to the <IMG ...> tag, including ALIGN, HSPACE, and VSPACE.





About the Author
Copyright 1997-2002 Idocs Inc. Content in this guide is offered freely to the public under the terms of the Open Content License and the Open Publication License. Contents may be redistributed or republished freely under these terms so long as credit to the original creator and contributors is maintained.