HTML Frames

 

Frames are a mechanism by which you can split your web page into separately-scrolling sections. This is sometimes done for things like a navigation panel on the left side.

I'm not going to spend much time on HTML Frames - and that's because they are kind of outdated and a bad idea. The reason is simple - they are not search-engine friendly. First, they make it hard for search engines to accurately index your site. Second, the way frames work is to create a layout page with no content which defines where the content pages should be. Thus, a page with two frames would actually be three HTML files. The main file would have no content but rather define layout. This screws up search engines because the search engine will naturally link directly to your content pages. What a mess!

Note convinced? Ok then, here you go: HTML Frames in a Nutshell!

Let's create a simple frames example so you can see for yourself.

Ok, the trick to frames is the fact that the frames are defined by a strange HTML page with a <frameset> tag in the place where the <body> would normally be. Here's an example. Save it in your project folder as "frameset.htm" and open it in a browser.

 <html>
  <head><title>Simple Frames Example</title></head>
  <frameset cols="20%, *">
   <frame src="default.htm" name="left">
   <frame src="second.htm" name="right">
  </frameset>
 </html>

Notice the 20% defines the width of the left frame html frames while the asterisk (*) assigns the remaining 80% of the window to the right frame html frames

Satisfied? Now do yourself a favor and forget about HTML Frames completely!

Let's move on to something much more useful -- HTML forms!