XHTML frames are a way of viewing multiple web pages at the same time through the same "frame" or browser window. To make this work, a "frameset" XHTML document must specify which other XHTML documents to view. The frameset is also usually used to specify the dimensions of the documents within the viewing space.
A simulated frameset is shown in the example below (in this case, CSS is used to simulate the frameset effect):
The code for a frameset could look something like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <frameset rows="*" cols="239,370"> <frame src="left_frame.htm" title="Navigation" /> <frame src="right_frame.htm" title="Main Content" /> </frameset> <noframes> <body> <p>Put alternative content here for when frames are disabled.</p> </body> </noframes> </html>
Notice that the <frame> elements contain links to other
web pages. Those pages are completely separate from the frameset, and are
normal web pages, complete with <head>, <body>, doctype,
and everything else. The cols attribute specifies the width of each of the
frames. The width can be specified in pixels or as a percentage of the total
width of the frameset.
Framesets can get more complicated than this, but these are the basics.
In general, frames should be avoided unless absolutely necessary. They complicate things for both users and the developer. The only times when frames could be considered "necessary" are when two completely separate documents must be shown simultaneously side by side (or one above the other, or in some other similar configuration). This is a rare circumstance, but it does arise occasionally.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License.