Inline (Floating) Frames

Microsoft Internet Explorer 3.0 introduced a feature called inline frames, which are identified with the <iframe> tag. They enable a scrollable frame to be placed anywhere within the flow of an HTML document, much like an image.

Although, as of this writing, inline frames are still only supported by Internet Explorer (limiting their practicality), the <iframe> tag and its attributes currently appears in the W3C’s HTML 4.0 Specification. With the W3C’s thumbs-up, we may see more browsers supporting this nifty feature in future versions. See Section 11.7.4 later in this chapter for an example of how to create a similar effect in a way that works in Netscape Navigator, too.

Placing an inline frame is like placing an image on a page. As shown in the following code, within the <iframe> tag, specify the width and height of the frame and the HTML file you want it to display. As with images, you can align the frame on the page and specify hspace and vspace. As with frames, you can specify margins within the frame and border display. Figure 11.9 shows the results.

<HTML>
<HEAD><TITLE>IFRAME</TITLE></HEAD>
<BODY BGCOLOR="black" TEXT="white">

<H2>Inline (Floating) Frames</H2>

<IFRAME SRC="scrolly.html" WIDTH=200  
HEIGHT=100 ALIGN=left HSPACE=12></IFRAME>

Microsoft Internet Explorer 3.0 introduced a feature called inline frames... 
</BODY>
</HTML>
Inline frame with IE’s <iframe> tag

Figure 11-9. Inline frame ...

Get Web Design in a Nutshell 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.