<FRAME>

Defines a frame in a frameset


[HOME] [PAGE UP] [PREV PAGE] [NEXT PAGE]


An element used to define an area within a frameset.

   <html>
        <head>
        <title>An unseen page that defines frames</title>
        </head>
        <frameset frameborder="0" framespacing="0" border="0" rows="*">
          <frameset frameborder="0" framespacing="0" border="0" cols="135,*">
==>>          <frame name="LeftSide" src="leftside.htm" scrolling="auto" marginheight="2" marginwidth="2">
==>>          <frame name="RightSide" src="rightside.htm" scrolling="auto" marginheight="5" marginwidth="5">
         </frameset>
          <noframes size="+1">
          <body>
             .
             .
          </body>
          </noframes>
        </frameset>
        </html>

I know this example is a little more than I normally provide but for me, the concept of frames was always a little intimidating. Once I figured it out, it was so obviously simple that I want to try to make it that way for you, too. I will probably repeat a lot of this same material on the frameset page just in case you never make it there.

One of the most important things you need to notice in this example is that the frameset elements are outside the body elements. And if I wanted to be really tacky I could have left out the noframes element and not had a body statement at all. So what, you say! Well, if you put in body statements (which are technically optional anyway) around the frameset then you'll get some unexpected results. Believe me, it happened to me.

This is the place that I had my first run-in with Microsoft Front Page. My original home page defined the frameset with one statement, showing both the row and column values. Everytime I brought the set into the editor it did strange things to the setup. It seemed to combine the two values and I ended up with the left side on the top and the right side on the bottom. I kept playing with the lines until we reached this happy compromise that I show in the example. The more I look at it the more sense it makes so I'm not quite as mad as I first was.

Well, enough about the general structure, let's look at the subject of this page, the frame element. Through the cols attribute of the second frameset element, I've defined two vertical areas on my page - the left one is 135 pixels wide, not subject to negotiation, and the right side gets whatever space remains. Now, using my two frame statements, I give the browser some particulars about how to treat these two areas. The first thing I do is give them names - LeftSide and RightSide. Real original right? This is so I can name these areas in later hyperlinks as targets for the display of pages.

The next thing I do is tell it which pages to initially load into these areas when the base page is loaded. I've kept my creative juices flowing and came up with leftside.htm and rightside.htm.

Now, I get to define some of the appearance stuff. This was really important to me because I wanted to achieve a "frameless" look with the stuff on the left magically staying still while you scrolled the stuff on the right. My plan is to keep the left side short enough that it won't fall into the scrolling mode and bring up those ugly slider bars! That's why I set the size to 135 pixels wide also. Anyway, I set scrolling to auto so the browser can decide for itself whether to use slider bars. On the left side I put a 2 pixel margin around all sides of the page and on the right I put a 5 pixel margin all around.

I haven't played with more than 2 frames on a page. I think it kind of clutters up the screen a little bit and it can make it hard for the viewer to navigate around.

HTML 3.2 Final

    Not a peep.

Netscape

They were first to bring out these elements. The frame attributes are:

name
This assigns a name to the screen area which permits it to be the target of hyperlinks (which means you can tell the browser where to display the page the user just selected from your list).
src
The name of the page to display when the frameset is initially loaded. If you don't specify a name then the frame will be blank.
marginwidth
marginheight
Used to specify the margins at the top/bottom and sides of the frame. These values are in pixels. If you don't specify them then the default is 0, or no margins.
scrolling
Defines whether the frame will have scrollbars or not. If you don't specify the action then the default is auto. Your other choices are yes or no. If you specify yes then you'll always show scroll bars. On the other hand, if you say no then you won't. Which could be kind of embarassing if your frame extends too far down the screen and the viewer has no way to scroll down the page!
noresize
Another way to exert your authority is to put in the noresize attribute. This prevents the viewer from changing the size of your frames. Personally, I've never had the urge to do that but I'm sure there are some out there who take a perverse delight in monkeying with other people's creations. This little attribute can keep them from doing that to your page.

Microsoft Internet Explorer

    Nothing to add.

Internationalization

    Nothing special.


[HOME] [PAGE UP] [PREV PAGE] [NEXT PAGE]


The Rusk Family . . . "the Legend Continues"

Michael T. Rusk
Comments to author: mrusk@radix.net

All contents copyright © 1996, 1997 Michael T. Rusk
All rights reserved.

Revised: December 03, 1997 10:40 -0500
URL: ./htmlgd/tagframe.html