home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeHTML & XHTML: The Definitive GuideSearch this book

11.6. Inline Frames

To this point, our discussion has centered around frames that are defined as part of a frameset. A frameset, in turn, replaces the conventional <body> of a document and supplies content to the user via its contained frames.

The HTML 4 and XHTML standards let you do things a bit differently: you can also define a frame that exists within a conventional document, displayed as part of that document's text flow. These frames behave a lot like inline images, which is why they are known as inline frames.

All Internet Explorer Versions 4 and later, but only the latest version of Netscape Navigator (Version 6), support inline frames.

11.6.1. The <iframe> Tag

Define an inline frame with the <iframe> tag. The <iframe> tag is not used within a <frameset> tag. Instead, it appears anywhere in your document that an <img> tag might appear. The <iframe> tag defines a rectangular region within the document in which the browser displays a separate document, including scrollbars and borders.

<iframe>

Function:

Define an inline frame within a text flow

Attributes:

ALIGN

MARGINWIDTH

CLASS

NAME

FRAMEBORDER

SCROLLING

HEIGHT

SRC

ID

STYLE

LONGDESC

TITLE

MARGINHEIGHT

WIDTH

End tag:

</iframe>; never omitted

Contains:

body_content

Used in:

text

Use the src attribute with <iframe> to specify the URL of the document that occupies the inline frame. All of the other, optional attributes for the <iframe> tag, including class, frameborder, id, longdesc, marginheight, marginwidth, name, scrolling, style, and title, behave exactly like the corresponding attributes for the <frame> tag. Section 11.4.1, "The <frame> Tag"

Use the content of the <iframe> tag to provide information to users of browsers that do not support inline frames. Compliant browsers will ignore these contents whereas all other browsers ignore the <iframe> tag and therefore display its contents as if it were regular body content. For instance, use the <iframe> content to explain to users what they are missing:

...other document content
<iframe src="sidebar.html" width=75 height=200 align=right>
Your browser does not support inline frames.  To view this
<a href="sidebar.html">document</a> correctly, you'll need 
a copy of Internet Explorer or the latest Netscape Navigator.
</iframe>
...subsequent document content

In this example, we let the user know that they were accessing an unsupported feature and provided a link to the missing content.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.