- slide 1 of 3
What is a Frame Used For?
HTML frames are used to display more than one document in a given window, with each document the ‘frame’ referred to.
The <frameset> tag is used to utilize frames, and is used to determine how the screen is sectioned in terms of rows and columns.
Let’s have a look at an example:
Say we want to define a particular frameset as having two columns, and we want the fist column – the first frame, or document – to occupy 40 percent of the width of the window, with the second column – or document – the remaining 60 percent, the command would appear in the HTML as follows:
<frameset cols=”40%,60%”> <frame src=”frame_x.htm”> frame src=”frame_y.htm”></frameset>
Explaining the example:
Quite simply, the above says “First document to occupy 40%, second to occupy 60%; first document is x.htm, second is y.htm.”We can clearly see, book ending the command, the opening - <frameset.. – and closing - </frameset> tags that indicate this is a frame definition. Take note, also, that you do not have to use the percentage as a defining size – if you know the size of the document or image, you can set the command using pixels.
- slide 2 of 3
Difficulty of Keeping Frames Synchronized
As you can see from the example above, the web designer (you in this case) will already be faced with the added difficulty of keeping two different documents correctly synchronised on one page.
- slide 3 of 3
Reasons Why Frames Aren't Preferred
Using HTML frames in web pages is a subject that has aroused much controversy of late, and it is now widely suggested that a site is better off without frames than with.
The reason for this centers around the fact that many people utilize web browsers that do not recognize frames, and as such your traffic will be limited by their presence. The use of frames also creates difficulties in printing whole pages. It is regarded as fact that there are alternative methods of similar presentation styles that can be obtained without using frames, and the difficulty experienced in synchronizing frames is one much better left alone.
Nevertheless, you may still want to use frames for your site. If you do decide to use frames, please bear in mind the above advice.