Tuesday, 11 April 2017

Simple Example of Frameset

Example 1: To have horizontal frames, We must use the rows attribute:

<html>
<head>
<title>frameset</title>
</head>
<frameset rows="10%,80%,10%">
<frame src="frame1.html">
<frame src="main.html">
<frame src="frame2.html">
</frameset>
</html>
In this example we have create three horizontal frames. the size of the top and  bottom one is 10% each and the middle one covers 80% of the screen.
the browser view of above example:


Example 2: To create only two frames.

<html>
<head>
<title>frameset</title>
</head>
<frameset rows="20%,*">
<frame src="frame1.html">
<frame src="main.html">
</frameset>
</html>

the browser view of above example:

In this example the screen has been divided into two frames. the top frame is covering 20% of the screen and the bottom one covers the remaining 80 percent, even though we have not specified the size. we have used a wildcard * here which will take up the remaining space from 100%. 

Example 3:We can specify the size in pixels instead of percentage.

<html>
<head>
<title>frameset</title>
</head>
<frameset cols="160,*">
<frame src="frame1.html">
<frame src="main.html">
</frameset>
</html>

the browser view of above example:


In this Example we have specify the size of frame in pixels. the first frame on the left has a size of 160 pixels. second fram covers the remaining portion of the screen as we have used the *.







2 comments: