Lesson 4.02 — Framesets and Frames

A frameset is just what it says: a set of frames. You must define the set and the (initial) source or content of each frame in order to create a complete page. Let's look at a simple example to get started:

<html>
<head>
<title>My website</title>
</head>
<frameset cols="20%,80%">
<frame src="my_nav.html" name="nav">
<frame src="my_content.html" name="main">
</frameset>
</html>

This code defines one web page in a complete manner. The page consists of one frameset (note the absence of the BODY element), which is made up of two frames. These frames will lay out as columns; the left frame takes up the left-most 20% of the browser window and the right column takes up the other 80%. The initial content or source of the left frame is the HTML object my_nav.html, while that of the right frame is my_content.html.

Note the code name="" in the FRAME element: you must name your frames! In this example I named my frames "nav" and "main", although I could have named them "John" and "Frank" if wanted to. But that would be more confusing, so I suggest sticking with names you'll be able to keep track of — and you'll soon realize just how important it is to keep track of your frames!

Proceed to The Frameset Element.