Frame Tags

Tags Description
<frameset> Defines a set of frames
<frame> Defines a sub window (a frame)
<iframe> Defines an inline sub window (frame)
 
 
Tags and its Attributes:
 
Tags Attribute Value Description
<frameset> rows pixels, % part of page Defines the proportion of division of page in horizontal frame.
cols pixels, % part of page Defines the proportion of division of page in vertical frames.
<frame> src path of the file path of the file which in to displayed in frame.
noresize noresize Defines weather the frames resizable or not.
name name of frame Provides the name of frame.
<iframe> src path of the file path of the file which in to displayed in iframe.
name name of iframe Provides the name of iframe.
 
 
<frameset> Tag
The <frameset> defines the set of frames or you may say, it defines no. of frames we will have on the a page. The frameset is a set of frames.
 
Format:
<frameset rows=”pixels or % of page, pixels or % of page,….,pixels or % of page”>
 
Examples:
<frameset rows=”30%,40%,30%”>
 
This example will create the three horizontal frames with area of 30%, 40%, 30%. As 100% area is divided in three parts of 30%,40% and 30% for three frames.
 
<frameset rows=”30%,*”>
 
Star character ‘*’ here represents the remaining part of the screen.
This example will create the two horizontal frames with area of 30% and whatever is remaing part of the screen will the height of second frame. As 100% area is divided in two parts of 30% and then the remaining screen area will be second frame.
Note: This * is commonly used for creating frames.
 
 
Its Attributes:
rows: it is used when user wants to create the horizontal frames.
cols: it is used when user wants to create the vertical frames.
 
If you want to create the three horizontal frames of ratio 20%, 50%, 30% of the page.
Then the <frameset> tag will be:
<frameset rows=”20%,50%,30%”>
 
If you want to create the three vertical frames of ratio 20%, 50%, 30% of the page.
then the <frameset> tag will be:
<frameset cols=”20%,50%,30%”>
 
In both the examples the first frame is of 20%, second is of 50%, third of 30%.
But <frameset> alone will not display the frames it only defines the set of number of frames it will have. To display those frames make the use of <frame> tag.
 
 
<frame> Tag
The frame tag displays the empty frames. <frame> tag is used between the start & end tag.
If you want to display the other pages in the frames then use src attribute of <frame> tag.
 
Format:
<frame src=”path of file” noresize=”noresize” name=”any_name”>
 
Example:
<frame src=”d:\html\frames.php” noresize=”noresize” name=”frame1″>
 
 
Its Attributes:
src: defines the path of file which is to be displayed in the frame.
noresize: defines the resize property of the frame, if we defines the its value as “noresize” then the you can not change the size of frames. The frames are not resizable. Move the mouse over the borders between the frames and notice that you can not move the borders.
 
And if you need resizable frames then do not use “noresize” attribute in <frame> tag.
 
name: defines the name of the frame. You can provide the name of your choice.
 
 
<iframe> Tag
It is the tag for the inline frames. The inline frame is the small frame which can be inserted on any web page. It is defined inside the body of the html file. It is not resizable.
 
Format:
<iframe src=”path of file” name=”name_of_this_frame”>
 
Example:
<iframe src=”c:\html\lists.php” name=”iframe”>
 
 
Its Attributes:
src: defines the path of file which is to be displayed in the frame.
name: defines the name of the frame. You can provide the name of your choice.
 
How To create Horizontal Frames
Example:
if you want to create three horizontal frames of area 20%, 50%, 30% then first use the <frameset> Tag.
so now lets do some Practical.