Frames allow you to divide the page into several rectangular areas and to display a separate document in each rectangle. Each of those rectangles is called a "frame". Frames are very popular because they are one of the few ways to keep part of the page stationary while other parts change. Frames are also one of the most controversial uses of HTML, because of the way the frames concept was designed, and because many web framed web sites are poorly implemented.
Why Frames on HTML?
=> With frames, you can display more than one Web page in the same browser window.
=> Frames allow for multiple documents/web pages to be displayed inside one browser window at a time.
Most typically frames are used to have a menu in one frame, and content in another frame.When someone clicks a link on the menu then that web page is opened on the content page.
Here is an example of a basic frameset with a menu on the left and content on the right.
<HTML> <head> </head> <frameset rows="20%,*"> <frame src="title.HTML"> <frameset cols="30%,*"> <frame src="menu.HTML"> <frame src="content.HTML"> </frameset> </HTML>
The Frameset Tag
=> The <frameset> tag defines how to divide the window into frames
=> Each frameset defines a set of rows or columns
=> The values of the rows/columns indicate the amount of screen area each row and column will occupy
The Frame Tag
=> The <frameset> tag defines what HTML document to put into each frame
In the below example we have a frameset with two columns. The first column is set to 25% of the width of the browser window. The second column is set to 75% of the width of the browser window. The HTML document "frame1.html" is put into the first column, and the HTML document "frame2.html" is put into the second column.
<frameset cols="25%,75%">
<frame src="frame1.html">
<frame src="frame2.html">
</frameset>