FRAMES |
|
Some people hate frames, in fact there's even an Offical I Hate Frames Club... Older browsers didn't handle them very well, and many people didn't do them very well at first. But if you take the time to do them right, they can make navigation incredibly simple and add a great deal to the look of your site. Frames divide the browser widow up into smaller windows, and allow you to control each frame individually. You can have a navigation scheme in one window, a logo in another, and display different pages in a third. Frames can be pretty confusing to just talk about, so I've created an example. Click here to open up a new browser window with a pretty simple frame example. Then you can switch back and forth between browser windows and use the View-Document Source and View-Frame Source to see what we're talking about in action. The example site is a common format. It has split the browser window into two frames, a Table of Contents and the Main window where the different pages of the site will be displayed. Frames start out with a FRAMESET page. The page that defines the FRAMESET doesn't have anything else on it, it's just a outline. You need the normal HTML, HEAD and TITLE tags, with their closing tags, but don't use a BODY tag. Instead you have the FRAMESET tag. |
|
The FRAMESET tag and its attributesFRAMESET is a container tag, can hold other html tags, requires a closing /FRAMESET tag, and must take one or the other of the following attributes, but not both.
It can also take the following:
|
|
|
or Our example will use: |
The COLS and ROWS attributes |
Once you've cut up the window with the FRAMESET, you need to define how each frame will act and what will be shown inside it when the page first loads. For that, you use the FRAME tag. |
|
The FRAME tag and its attributesThe FRAME tag is not a container tag. It goes between the opening and closing FRAMESET tags, and refers to the COLS or ROWS that you specified in the FRAMESET tag. So if you used the FRAMESET above, you would need two FRAME tags to define each of the windows. It can take the following attribute:
|
|
|
|
The SRC attribute |
|
|
The NAME attribute |
|
The FRAMEBORDER attribute |
|
|
The MARGINWIDTH and MARGINHEIGHT attributes |
|
|
The SCROLLING attribute |
|
|
The NORESIZE attribute |
|
|
Switch over to the other browser window and take a look at the Document Source. What you'll see is the contents of "frame.html", which defines how the window will be split up and where to find the pages to fill each frame. Then click anywhere in one of the frame panes and take a look at Frame Source. Now you'll see the source for the actual page filling up the frame window. |
|
| previous | next | contents |