Introduction to Frames

line.gif

In HTML, the tags <frameset> and <frame> are used to divide a document into frames. The document that defines the frameset(s) should contain only the frame definitions - not tags to format the document. For example, consider the document below.

<html>
<head>
<title>Frame Example</title>

<frameset rows="50%,*" cols="25%,*">
 <frame src=frameA.htm>
 <frame src=frameB.htm>
 <frame src=frameC.htm>
 <frame src=frameD.htm>
</frameset>

</head>
</html>

where no body is required for the top level frame document. The asterisks in the specification of the attributes rows and cols indicate that the remaining portion of the browser window should be allocated to the frame.

FrameA.htm, frameB.htm, frameC.htm and frameD.htm are separate HTML documents. The source for frameA.htm is shown below, and the others are very similar.

<html>
<body>
<p>This is frameA.htm.
</body>
</html>

Exercise 17

Implement and test the above example.

Take this link to see the solution to the exercise. You should add the solution of this exercise to the samples panel that you created in exercise 6.

The next section next.gif presents an example of how frames may be combined with links to structure documents.