HTML Frames Basics
By Stephen Bucaro
A frame creates a separate pane within the browser window. A frame can
contain its own webpage, or it can provide a different view of the same webpage
in another frame in the same browser window. A frame may have a border, or be
borderless. A frame may or may not have scrollbars. A frame may or may not be resizable.
A frame is always contained within a frameset which may contain one or
more frames. The frameset shown above contains three frames, the menu and
content area frames are within one frameset which is nested along with the header
frame inside a second frameset. The code for this example is shown below.
<html>
<head>
<title>Amendments to the Constitution</title>
</head>
<frameset rows="110, *">
<frame src="header.htm">
<frameset cols="120, *">
<frame src="menu.htm">
<frame name="content" src="content1.htm">
</frameset>
</frameset>
</html>
The <frame> tag defines a frame within a <frameset>. A frame may
have the following attributes:
Attribute | Description |
src | URL of the document to be displayed in the frame |
name | Name used for TARGET attribute in <a href> links |
frameborder | Whether to display a border, 1=yes or 0=no |
framespacing | Space between frames, in pixels |
marginwidth | Size of left and right margins, in pixels |
marginheight | Size of top and bottom margins, in pixels |
scrolling | Defines scrolling, values are yes, no and auto |
noresize | Prevents user from resizing the frame |
The <frameset> </frameset> tags define a set of frames.
<html>
<head>
<title>Two Vertical Frames</title>
</head>
<frameset cols="200, 400">
<frame src="leftcol.htm">
<frame src="rightcol.htm">
</frameset>
</html>
The document that defines the frameset has a head section, but no
body section. The frameset tags take the place of the body tags. A
frameset may have the following atributes:
Attribute | Description |
rows | Width of frame in number of rows or percentage of window width. * indicates frame should take up remaining space |
cols | Height of frame in number of columns or percentage of window height. * indicates frame should take up remaining space |
|