We use the FRAME element to define the contents and appearance of each frame in a frameset.
The FRAME element requires only a start tag; the end tag is forbidden.
The SRC attribute sets the initial document that the frame will contain, which is specified as a URI.
<frameset rows="15%,*">
<frame src="frame 1 content URI">
<frame src="frame 2 content URI">
</frameset>
The browser loads each file into its corresponding frame in the frameset.
The NAME attribute assigns a name to a frame, which may be used as the target of subsequent links.
<frame src="content URI" name="framename">
Specifying the frame’s name in the target attribute of a link opens a document in the frame.
A FRAME element’s behavior and appearance may be set with the following attributes.
The NORESIZE attribute is a boolean attribute means true when present and tells the browser that the frame is not resizeable.
<frame src="content URI" name="framename" noresize>
The SCROLLING attribute specifies scroll information for the frame. Possible values are:
- auto tells the browser to provide scrollbars for the frame when necessary. This is the default value.
- yes tells the browser to always provide scrollbars for the frame.
- no tells the browser not to provide scrollbars for the frame.
<frame src="content URI" name="framename" noresize scrolling="auto">
The FRAMEBORDER attribute provides the browser with information about the frame border. Possible values are:
- 1 (one) tells the browser to draw a separator between this frame and every adjoining frame. This is the default value.
- 0 (zero) tells the browser not to draw a separator. Note that separators may be drawn next to this frame if specified by other frames.
<frame src="content URI" name="framename" noresize frameborder="0">
The MARGINWIDTH attribute specifies the amount of space to be left between the frame’s contents in its left and right margins.
The MARGINHEIGHT attribute specifies the amount of space to be left between the frame’s contents in its top and bottom margins.
Both values must be greater than one pixel. The default value depends on the browser.
<frame src="content URI" name="framename" noresize
marginwidth="5" marginheight="5">
This last example shows how the different frame atttributes discussed above may be set on a sample frameset
<frameset rows="12%,*">
<frame src="/shared/head.aspx" name="head"
marginwidth="5" marginheight="5" scrolling="no" noresize>
<frameset cols="85%,*" border=0>
<frame src="intro.aspx" name="content"
marginwidth="5" marginheight="5" noresize>
<frame src="links.aspx" name="links"
marginwidth="5" marginheight="5" noresize>
</frameset>
<noframes>
... alternate content ...
</noframes>
</frameset>
Some relevant external references:
Previous: Using Tables Next: Using Forms