Frames and Frameset Tag

What is Frames in HTML?
How to divide the window using frameset tag?

Explanation

<frameset tag>:
Frameset element is used to divide the window into frames with mentioned width and height. Rows and columns can be defined by using the ROWS and COLS attributes. Rows and cols are defined by the percentage(%) to get the desired frames.

Example Code:

<frameset rows="50%,50%" cols="50%,50%">
<frame name="Img1" >
<frame name="Img2" >
<frame name="title1">
<frame name="title2">
</frameset>

Result:
Noresize & Scrolling:
Noresize and scrolling attributes are much used here to customise the window size. Noresize will not allow the user to adjust the frameborder. Scrolling can be done by setting Scrolling attribute as "Yes/No". These both attributes are used to make the frames more precise.

Example Code:

<frameset rows="50%,50%" cols="50%,50%">
<frame noresize="noresize" name="Img1" >
<frame noresize="noresize" name="Img2" >
<frame noresize="noresize" name="title1">
<frame noresize="noresize" name="title2">
</frameset>
Result: Likewise, we can have different type of frames by using the above frameset tags. Frameset is mainly used for navigation within the single window and to display multiple web pages at the same time.



Navigation within frames:
Mostly the web site uses the frames to have the links in left frame and its contents to be opened in the right frames. There can be navigation within the frames in a single window. The links in the first frame can be linked to any other frames in the same window. The site navigation can be done just by giving the target link to the frame name of the same window.

Example Code:

<frameset cols="150,*">
<frame name="left" scrolling="no" noresize target="rbottom" src="leftpane.htm">
<frameset rows="20%,*">
<frame name="rtop" scrolling="no" noresize align="center" target="rbottom" src="head.jpg">
<frame name="rbottom" src="http://www.hiox.com">
</frameset>
<noframes>
<body>
<p>This page uses frames, but your browser doesn't support them.</p>
</body>
</noframes>
</frameset>
Result: Thus, the frameset is used in making the webpages more compatible and ease to navigate. The links can be given from any frame to other.
Drawbacks:
Frameset do also have some drawbacks which makes its usage much low.
1. First, it is hardly affected by search engines. You have to create seperate pages especially for the search engines which does not support them.
2. While bookmarking a page, only the frames get bookmarked and not the exact html page. So, it is difficult to catch the relevant page on visiting the bookmarked page.

Ask Questions

Ask Question