HTML » Tags » frame

Version: 4.0

Compability: Explorer 4, 5  Netscape 4, 6

<frame ... >

The <frame> tag is used to create one frame, which is simply a window within another window. As an example, if you want three frames (windows) to appear on an HTML page, you must have three frame tags and the frameset element must set the spacing for three frames.

The frame tags can only occur between an opening and closing frameset element.
A frame element displays content, including forms, images, multimedia, other frames, tables, etc. It is very important to understand that the only way to assign content to a frame is to assign a URL using the src attribute. Whatever content is displayable at the referenced URL will in turn be displayed inside the frame.
The frames can have either a column (vertical) or a row (horizontal) configuration, but not both. The configuration must be set using either the cols or the rows attribute of the frameset tag, but not both. The order of the frame tags sets the order of the frames. If they are in a rows configuration, the first frame element is the top window, the second frame element is second from the top, etc. For the cols configuration, the order is left to right.
Note that you can nest frameset tags inside of frameset tags. Therefore, an HTML document can contain numerous frames. This opens the possibility of creating complex and imaginative page displays (however, always remember to keep the page user friendly).


<title>frames example</title>
<frameset cols="50%, 50%">
      To be viewed properly, this page requires frames.
   <frameset rows="33%, 33%, *">
      <frame src="html_frames_red.html">
      <frame src="html_frames_orange.html">
      <frame src="html_frames_yellow.html">
   <frameset rows="50%, 50%">
      <frame src="html_frames_green.html">
      <frame src="html_frames_blue.html">

This example creates five frames, each with a different background color. Note that there is no body tag.

Language(s): HTML

See Also: