How to Create a Frameset
Frames allow the display of more than one HTML document in a Web browser window. The <frameset> tag defines the frameset size and tells the browser what documents to use. The <frame> tag defines each individual frame. The use of frames was extremely popular in the early days of the World Wide Web, but Web developers eventually moved on to other display methods such as using tables and, eventually, CSS, or Cascading Style Sheets. Frames are still occasionally used for their simplicity.
Instructions
-
-
1
Open a new document in an HTML or text editor.
-
2
Use the following code to define the frameset:
<html>
<frameset cols="25%,*,25%">
<frame src="frame_1.htm" />
<frame src="frame_2.htm" />
<frame src="frame_3.htm" />
</frameset>
</html>
Change the percentages in the "cols" attribute to make the frames smaller or larger. the "*" character allows a frame to display on any percentage of the screen that the other frames are not using. Replace "frame_n.htm" with the file name of the HTML files to which your frames will point.
-
-
3
Use the "rows" attribute in the <frameset> tag in place of or in conjunction with the "cols" attribute to define your frames as rows. Change the percentages as desired.
-
4
Use the "class" attribute in the <frameset> to give your frameset a classname. Add the "id" attribute in the <frameset> tag to give your frameset a unique id. Employ the "style" attribute in the <frameset> tag to give your frameset an inline style. Apply the "title" attribute in the <frameset> tag to give your frameset a title or any extra information.
-
5
Save the HTML file and open it in your Web browser to test that your frameset is working correctly.
-
1
Tips & Warnings
The "onload" and "onunload" attributes of the <frameset> tag allow you to run a script upon load or unload of the frameset.