Tutorial 5: Using Frames in a Web Site
Using Frames to Display Multiple Web Pages
Additional Topics
Using the <base> Element
In this tutorial, you use the <base> element in order to specify the default target for hyperlinks in a frame layout. Another use for the <base> element is to specify the default URL of the document. The syntax of the <base> element is:
<base href="URL">
where URL is the URL of the document.
The <base> element is useful in situations where the document is read out of context. By including the URL of the source document, the browser can then determine any partial URL's or relative paths that might be specified in either hyperlinks or <img> tags. Note that the <base> element appears in the HEAD section of the HTML file only.
The <iframe> Element
Originally developed by Microsoft, the <iframe> element became a W3C Recommendation with HTML 4.0. You can insert contents of an external Web page into your document using the <iframe> element. For example:
<iframe src="t01.html" width="200" height="150" title="Tutorial One, Developing a Basic Web Page"></iframe>
inserts the contents of the t01.html file into a layer that is 200 pixels wide by 150 pixels high.
To make your content available to browsers that do not support the <iframe> element, such as Netscape 4, you can place your content inside the <iframe> element. Content placed inside the <iframe> element will be ignored by browsers that support <iframe> but will be available to other browsers that do not.
You might wish to provide a text link inside the <iframe> element as an alternative means of accessing the t01.html file. For example, the following code:
<iframe src="t01.html" width="200" height="150" title="Tutorial One, Developing a Basic Web Page">Link to <a href="t01.html" title="Tutorial One, Developing a Basic Web Page">t01.html</a></iframe>can be used to display the contents of the t01.html file in browsers that support <iframe> and will provide a link to click on for browsers that do not support the <iframe> element. The above would then eliminate the need to duplicate your content for browsers not supporting <iframe>.
Note:
Netscape created and supported the <layer> tag for version 4 only and it is no longer recommended to use. See Netscape's <layer> tag documentation for further information.