Webmaster in a Nutshell

Previous Chapter 4 Next
 

4.3 The <frame> Tag

A frame document contains no displayable content (except for the contents of the <noframes> tag, if applicable). The <frame> tags provide URL references to the individual documents that occupy each frame. <frame> tags are standalone elements, and therefore do not require a closing tag.

Frames are placed into a frameset column by column, from left to right, and then row by row, from top to bottom, so the sequence and number of <frame> tags inside a <frameset> are important.

Netscape displays empty frames for <frame> tags that do not contain a src document attribute and for those trailing ones in a frameset that do not have an associated <frame> tag. Such orphans, however, remain empty; you cannot put content into them later, even if they have a target name attribute for display redirection.

Listed below are the basic attributes that can be used in the <frame> tag.

src=document_name

The value of the src attribute is a URL of the document that is to be displayed in the frame. The document may be any valid HTML document or displayable object, including images and multimedia. The referenced document may itself be another frame document.

name=frame_name

The optional name attribute labels the frame for later reference by a target attribute in a hypertext link anchor <a> tag. If a link that targets a frame's name is selected, the document will be displayed in the named frame. The value of the name attribute is a text string enclosed in quotes.

noresize

Even though you may explicitly set their dimensions with attributes in the <frameset> tag, users can manually alter the size of a column or row of frames. To suppress this behavior, add the noresize attribute to the frame tags in the row or column whose relative dimensions you want to maintain.

scrolling=[yes,no,auto]

Normally, the browser displays vertical and horizontal scrollbars for frames whose contents exceed the allotted space. If there is sufficient room for the content, no scrollbars appear. The scrolling attribute gives you explicit control over whether scrollbars appear. A value of yes turns the scrollbars on; no turns them off. The value of auto gives the default scrollbar behavior and is the same as not using the scrolling attribute at all.

marginheight=height marginwidth=width

The browser normally places a small amount of space between the edge of a frame and its contents. Those margins can be manually set with the marginheight and marginwidth attributes, whose values are given in pixels. You cannot make a margin less than one pixel, nor so big that there is no room left for the frame's contents.


Previous Home Next
Nested Framesets Book Index Frame Targets