Frames

This is going to be a very simple tutorial on frames, because as far as I've seen, the simpler the use of frames, the less intrusive they become. There's also going to be some info on fixing links to other pages so that they don't open in your frames.

Please keep in mind that not all browsers support frames. Therefore, if you're going to use frames, it's best to make a non-frames version of your page as well.

Frames need their own source code. You then insert other pages into the frames through this code:

<HTML>
<HEAD>
<TITLE> THIS WILL BE THE TITLE FOR ALL OF YOUR PAGES WITHIN THE FRAMES SO CHOOSE WISELY! </TITLE>
</HEAD>

<FRAMESET COLS="15%,85%" BORDERCOLOR=00ff00>
<FRAME NAME="frame1" src="sample6.html">
<FRAME NAME="frame2" src="sample7.html">
</FRAMESET>

</HTML>

Here's what it means: Here's how it looks.
As you can see, frames allow you to view two pages at the same time.

Generally, the smaller of the frames becomes the menu for the entire page. But the default setting for links in frames is that they open in the frame they're clicked on. So how do you get a link in the smaller frame to open in the bigger frame? This is why it's so important to name your frames.
Here's how to get a link in frame1 to open in frame2:

<A href="sample4.html" TARGET="frame2"> Po page </A>

TARGET tells the link where to open.

Take a look.

Now, if you tried the link on the page that opened in frame2, you noticed that it opened in frame2. This is one of the problems with frames, too many people just leave them like that, and if you like a page you're left to figure it out for yourself how to bookmark it. Here's a way to make sure your links don't open in your frames at all:

<A href="http://www.pbs.org/teletubbies" TARGET="_top"> the PBS page</A>.

Note the underscore (_) before top. This is important.

Check it out.
Keen, hunh?

If you'd like to learn more about frames, I suggest you check this out:
Frame tutorials

Back to the tutorial menu