Shri Ram College of Commerce

You are here :

Learning Resources (Frames)

University of Delhi, Maurice Nagar, Delhi 110 007

Home
HTML Tutorial
 
Frames in HTML are used to put in different webpages on a single web-page in a pre-desired format, either horizontally or vertically. These reduce the burden of typing a specific tag information repeatedly, especially in case of headers of web-pages, which have to remain the same throughout the series of webpages.

Lets take a simple example of a frameset...

 
 
< frameset cols="50%,50%" > 
< frame src="page1.html" > < frame src="page2.html" >
< /frameset >
The result of the frameset tag cannot be displayed on this webpage because the frameset tag works without the <body> tag. To view the result, please click here.
There can be various attributes that can be used with the frameset tag or the frame tag.
You can decide between a vertical frameset or a horizontal frameset.
For a vertical frameset, the attribute 'cols' would be used, and for the latter, 'rows' would be used.
Furthermore, you can add the number of frames by simply adding values to the cols or rows attributes.
To change the border of the frames, the border attribute can be added to the <frameset> tag.
All the above three cases are shown below :
<frameset cols="25%,10%,45%,*"> 
(Star denotes remaning space)

<frameset rows="20%,50%,30%">

< frameset cols="120,340" border="2">

(Values in rows or cols attributes can also be in pixels; a border value o would mean no border.)
Also, a new frameset can also be added to an existing frameset. For instance, you can add a vertical frameset to a pre-existing horizontal one.
 
< frameset rows="20%,*" > 
< frame src="page1.html" >
< frameset cols="200,160" > < frame src="page2.html" > < frame src="page3.html" > < /frameset >
< /frameset >
As far as attributes to the <frame> tag are concerned, there can attributes like 'scrolling' and 'noresize'.
< frameset cols="50%,50%" > 
< frame src="page1.html" noresize="noresize"> < frame src="page2.html" scrolling="no">
< /frameset >
Last but not the least, a frame can also be inserted into a webpage. This is called an in-frame denoted by the tag < iframe >.

< iframe src="page1.html" >
This finishes our discussion about frames.

Go Back
© SRCC, 2007

Website created and managed by Manav Jain, B. Com. (H) 2nd yr, Sec. B