skip to contentstylized crane logoWhite Crane Education

Frame Tags

An XHTML frame gives developers a method for putting multiple documents (i.e. XHTML pages) in the same browser window. This lets developers keep some information visible and in place while other pieces change or are scrolled.

Technical Considerations

A collection of frames can be layed out in either rows or columns. More complex designs can be made by nesting frames. The examples below show several approaches.

When you're creating a frame-based page, only html, head and title tags can appear on the page in addition to the frameset and frame tags.

A lot of developers argue loudly against the use of frames for a variety of reasons:

  1. Bookmarking Doesn't WorkIf you load a frame-based page and navigate around in it, e.g. by clicking on hyperlinks, then try to bookmark a page the bookmark will return you to the original page of the frameset - not the page to which you'd navigated.
  2. Search Engines Can't Reference PagesThis is actually the same issue as the previous one. The only state of the frameset that can be referrenced is the original one.
  3. Frame SizesBrowsers will automatically decide whether or not to display scroll bars within individual frames. This can result in an unsightly and non-standard situation where a scrollbar appears in the middle of a page and stops without reaching the bottom of the page. You can tell the browser not to display scroll bars on your frames but if the content in a fram exceeds the frame's size, this will leave the user with no way to get to content outside the frame's edges.

Examples

Technical Note: Because it isn't possible to put a frameset within a page containing other XHTML tags, the layout examples were constructed using tables.

XHTML Output
<frameset border="1" rows="33%, 33%, *">
  <frame src="blank.htm" />
  <frame src="blank.htm" />
  <frame src="blank.htm" />
</frameset>
frame 1frame 2frame 3
<frameset border="1" cols="33%, 33%, *">
  <frame src="blank.htm" />
  <frame src="blank.htm" />
  <frame src="blank.htm" />
</frameset>
frame 1
frame 2
frame 3
<frameset rows="33%, *">
  <frame src="blank.htm" />
  <frameset cols="25*, 75%">
    <frame src="blank.htm" />
    <frame src="blank.htm" />
  </frameset>
</frameset>
frame 1
frame 2frame 3

Cross-Refrerence