When To Use HTML Frames - How to create a website
Create a website RSS feed

When To Use Frames

When to Use Frames

Last update on: 07-16-2008
Before I show you what frames are capable of, I should mention that whether you use them is very much a matter of taste. A lot of beginners use frames in their sites, particularly creating one for navigation and the other for content. But then as they learn more about HTML and XHTML they tend to move toward using tables for layout and, increasingly, CSS.

Personally, there are very few circumstances in which I would suggest that you use frames in a page. The cases in which I think frames are useful include:

For each frame you have in a layout, you need to have a file to be its content (each frame is essentially its ownWeb page), so the number of files in your site quickly grows. You therefore need to be particularly careful with your file structure so that you do not get lost in a sea of extra files.

A couple of other drawbacks you should be aware of with frames are as follows:

While you know my opinion on frames, if you think their advantages outweigh the disadvantages, then you should use them. by the way I used frame in the Try It Out script to allow you see the result of the source code that you meet in each section.

First webpage using Frameset:
in this example we referred to call some websites in our 3 frames, but you can create deferent pages and browse them into these frames.


To create a frameset document, first you need the <frameset> element, which is used instead of the <body> element. The frameset defines the rows and columns your page is divided into, which in turn specify where each individual frame will go. Each frame is then represented by a <frame> element.
You also need to learn the <noframes> element, which provides a message for users whose browsers do not support frames.

You already know that there is no <body> element as it has been replaced with the <frameset> element; also, there should be no markup between the closing </head> tag and the opening <frameset> tag, other than a comment if you want to include one.

the <frameset> element must carry the two attributes rows and cols, which specify the number of rows and columns that make up the frameset. In our example there are just three rows, the first being 150 pixels high, the third just 100 pixels high, and the second taking up the rest of the page.

<frameset rows="150, *, 100">

Inside the <frameset> element are the empty <frames /> elements. The <frames /> elements indicate which page will be kept inside that frame using the src attribute. There is also a <noframes> element whose contents will be displayed if the user’s browser does not support frames.

Now that you have a good idea of how a frameset document appears, it’s time to look at the elements in a little more detail.


Working with Frames's lessons:

Introduction To Frames
When To Use Frames
The Frameset Element
The Frame Element
The Noframes Element
Creating Links Between Frames

Banner HomeServices Contact |  ©2009 http://www.iteachweb.net/