Sometimes you want a scrollable frame placed within the flow of an HTML document,
A frame like this is called a "floating frame" or an "inline frame," and is the
subject of the current lesson.
INDEX CARD #39:
WHAT IS A FLOATING FRAME? (39a)
A floating frame (also called an inline frame) is a frame
placed within the flow of an HTML document, like this:
What are the advantages of floating frames? Floating frames are much
easier to code than a regular frameset document, since they work much like an <IMG>
tag. They can give easy access to the contents of another web site,
without interfering with the flow of text.
What are the disadvantages of floating frames? As of this writing,
floating frames are only supported by Microsoft Internet Explorer, which greatly
limits their usefulness. However, you can give alternate text to appear
in browsers that don't support floating frames.
THE <IFRAME> TAG (39b)
Here is the general structure of the <IFRAME> tag:
Optional text for browsers that don't support floating frames goes inside
the container tag.
The only required attribute is SRC. All the attributes are
discussed on cards 39c and 39d.
ATTRIBUTES FOR THE <IFRAME> TAG (39c)
Use SRC to give the web address of the source.
Be sure to include the http:// part, or it won't work!
The source can also be a local file.
HEIGHT and WIDTH give the floating frame
size. You can use absolute measurements, in pixels, like HEIGHT="200".
Or, you can specify a percentage of the current window, like
Use ALIGN to align the frame along the left or right
margin of the web page. ("Left" is the default.) To center the frame,
just put the <IFRAME></IFRAME>
container inside a <CENTER></CENTER> container.
The SCROLLING attribute controls the appearance of the scrollbar.
if you always want a scrollbar to appear.
Use SCROLLING="no" if you
never want a scrollbar to appear.
Use SCROLLING="auto" (the default
value) if you only want a scrollbar to appear when necessary.
Use HSPACE to hold space to the left
and right of the frame (horizontal space).
Use VSPACE to hold space above and below the frame (vertical space).
Give measurements in pixels; for example, HSPACE="50".
MORE ATTRIBUTES FOR <IFRAME> (39d)
Use MARGINWIDTH and MARGINHEIGHT to control the
margins inside the frame; that is, between the edge of the frame and the frame contents.
MARGINWIDTH controls left/right margins; MARGINHEIGHT
controls top/bottom margins. Give measurements in pixels.
FRAMEBORDER="1" turns the frame border on (this is the default
FRAMEBORDER="0" turns the frame border off.
Use NAME="desired_name" to give a name to the
frame, so you can link to it.
Here's an example. The floating frame produced by this code appears just below
this index card:
(W39.1) Call up this lesson in NETSCAPE NAVIGATOR. What does it look like?
(W39.2) Create an HTML file containing the code on index card 39d. Use
SRC="http://www.yahoo.com" to load the YAHOO search engine into the frame.
Change each of the values of the
attributes, one at a time, to study the result. For example, change HEIGHT="200"
to HEIGHT="100" and see what happens. Then, REMOVE each attribute, one at a time,
to see what the default value is.
(A39.1) Please read pages 219220 (section on "Inline (Floating) Frames") in the Weasel Book.