Frames are an HTML option developed
1996. They divide the screen into several parts, each one a web page in itself, working
independently of other frames. The complete HTML Guide web site is composed of two frames:
The banner frame at the top of the screen and the main frame on rest of the screen.
The tag for a frame is:
<frameset>
You'll have to define the exact size of each frame with the cols attribute:
<frameset cols=X/,Y/>
X and Y represent the percentage of the screen each column takes. Thus X+Y=100. You may
have more than two figures (e.g. X+Y+Z+A=100).
You may also divide your frames-containing page into rows:
<frameset rows=X/,Y/>
Again, the variables represent the percentage of the screen each frame takes, and there
can be any number of frames.
Notice: The frames' tag is always written right after the
"Head" section of your html page.
There is no "body" section in the page containing the tags listed above.
Instead, from each frame there is a link to a web page, using the following tag:
<frame src=URL>
the tag is repeated for each frame. Here is a code for a frame-containing page:
<Html>
<head>
<frameset rows=60/,40/ cols=50/,50/>
<frame src=compare.htm>
<frame src=back.htm>
<frame src=http://www.microsoft.com>
<frame src=http://www.netscape.com>
</frameset>
</head>
</html>
To view the page this code will create, click here
As you may or may not know, a user can resize the frames he is browsing to suit
himself. If, however, you don't want the user to be able to resize the frames, simply add
the word "noresize" into each <frame src> tag:
<frame src="URL of page" noresize>
You can also set the frame border:
<frame src="URL of page" border="2">
Since frames were only created in 1996, older browsers do not support them. If one of
these browsers were to view a frames page, the user would not see a thing. However, the
new tag <noframes> displays an alternative page in the event that the viewer's web
browser doesn't support frames. After the <noframes> tag goes a <body> tag,
and then the regular HTML code, to create a normal page. you then close the body with the
</body> tag, and close the noframe with the </noframes> tag. For example:
<noframes>
<body>
<p>
This web page uses frames, but your browser doesn't support them. Click <a
href=noframe.htm>here</a> to go to an alternative page.
</body>
</noframes>
</frameset>
</html>
The above text is an example of the code that is related to the <noframes> tag.
Before this text you will need to have a normal frames code as described above.
Caution: Splitting your site into more than three frames will
usually break the thin line between convenient and annoying. Even less than that will
sometimes annoy surfers, so make sure you have a no-frame version of your site.
Congratulations!! You have
finished the Intermediate's guide. You now know how to add sound and other components to
your website, create a clickable image map, make tables and use them to format your site.
And in this lesson you learned how to frame your site. You are becoming a website pro. |