This article constitutes section 1, part B, chapter 7 of the CIW Website design manager course and briefly covers: Frames and Framesets.
Frames – an Overview
Frames and framesets are useful container objects for use within your HTML page. They are often used to position graphical elements although their usage should be limited to the presentation of only tabular data.
The <FRAMESET> Tag
The <FRAMESET> tag, or element, is a container tag that allows you to define regions in your browser window and assign seperate files to each. It requires a mandatory attribute of either COLS or ROWS that designates the number and size of columns or rows in a browser window.
COLS and ROWS may be specified as percentages or pixels, plus you may use a wild card to accommodate different visitor screen sizes.
<FRAMESET COLS=”40%,60%”> defines two columns of the given percentage widths.
<FRAMESET ROWS=”160,*”> defines two rows, the first being 160 pixels in height while the second will be the remaining window height.
The <FRAME> Tag
The <FRAME> tag defines the content in each frame and is place within the <FRAMESET> tag. The SRC attribute specifies the file that will appear in the frame.
The <NOFRAMES> tag
Not all browsers can display frames and other browsers may have the frames facility disabled. This is where the <NOFRAMES> tag comes into play. <NOFRAMES> is a container tag and anything between the opening tag and closing tag is displayed in a browser that is unable to display frames. At all other time the tag and it’s contents are ignored. It has been known, however, for unscrupulous web designers to use this area for keywords for the benefit of search engines. Not a recommended practice.
The Frameset Document
Frames are built with the <FRAMESET> and <FRAME> elements in an HTML document. The important thing to remember is that the <FRAMESET> element REPLACES the <BODY> element in this document.
Targeting Frames with Hyperlinks
When a hyperlink is used with frames you need to specify the URL to be loaded and the frame in which it should be displayed To achieve this you use the TARGET attribute:
<A HREF=”page1.html” TARGET=”main”>Link Text</A>