Frame Tags

You need to know only two tags in order to create a frame document: <frameset> and <frame>. In addition, the HTML 4 and XHTML standards provide the <iframe> tag, which you may use to create inline, or floating, frames, and the <noframes> tag to handle browsers that cannot handle frames.

A frameset is simply the collection of frames that make up the browser's window. Column- and row-definition attributes for the <frameset> tag let you define the number of and initial sizes for the columns and rows of frames. The <frame> tag defines which document—HTML or otherwise—initially goes into the frame within those framesets and is where you may give the frame a name to use for document hyperlinks.

Here is the HTML source we used to generate Figure 11-1:

<html>
<head>
<title>Frames Layout</title>
</head>
<frameset rows="60%,*" cols="65%,20%,*">
  <frame src="frame1.html">
  <frame src="frame2.html">
  <frame src="frame3.html" name="fill_me">
  <frame scrolling=yes src="frame4.html">
  <frame src="frame5.html">
  <frame src="frame6.html" id="test">
  <noframes>
    Sorry, this document can be viewed only with a
    frames-capable browser.
    <a href = "frame1.html">Take this link</a>
    to the first HTML document in the set.
  </noframes>
</frameset>
</html>
A simple six-panel frame layout

Figure 11-1. A simple six-panel frame layout

Notice a few things in the simple frame example and its rendered image (Figure 11-1). First, like tables, the browser ...

Get HTML & XHTML: The Definitive Guide, 6th Edition 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.