|
Frames and those that Float Frames are one of those things that can add exquisite elegance to your site, however, if overdone, can ruin your visitor's interactive experience completely. It is a very powerful tool, and the best thing to do is to master it, not avoid it. What Frames Can Do For YouFor the uninitiated, let me start by explaining what frames are. Earlier on in our development, we've worked with single pages at a time. We've also had to concentrate on packing the design, content, and frills of each page in one measly file. With frames, you have the ability to, essentially, display more than one page at the same time. It will divide up your browser display area into separate "windows." Previously, we've worked with using only one window to display one window. With multiple windows, quite a few revelations can occur. You can separate your site menu from the rest of your page. This will definitely save your visitors from having to load this menu again and again for each page they go to. Thus, it has the potential to both enhance navigation style and save bandwidth (especially if you have a huge menu =]). Our team talks more about menu design and placement in our Designer Diaries. As well, it is a full length introduction to targeting and loading windows. Well, enough of the promises of the things to come, let's get on with the show! Windows of OpportunityI'll begin this with some quick terminology and an introduction to the <FRAMESET> tag. A frames page has a certain type of hierarchy to it. What you see is the product of all these frames (windows) glued together, but each frame loads its own page. You are free to break out your sketchpad and quickly pencil in some frame designs while we learn more and try it out on our page generator :) The coding? It starts out just like a regular page with the <HTML> and </HTML> tags; you can add <HEAD> </HEAD> tags so as to name your page, but there are no <BODY> container tags. Let's start with a simple example that creates a <FRAMESET> with two windows. when you create a vertical partition in your frameset, which looks a little like this in your browser: You are creating 2 column frames... ...With the following code. Pay particular attention to the code in between the <FRAMESET> </FRAMESET> tags...
<HTML>
<Frameset COLS="50%,50%"> </HTML> Notice that in the opening <FRAMESET> tag, you are telling it to create two COLS (or columns) that each take up 50% of the width of the browser's window. Since you specified two widths (left window to right window) COLS="width#1,width#2" the browser realizes that you want only two columns. Also, for the width value, you can make it dynamic, which comes in handy. If you had typed <Frameset COLS="50%,*">, the browser would have automatically determined the value of * (100% total - 50% already specified). You can specify more than one value to be dynamic (to take up whatever space is left over after all the other frames are sized) and it will calculate the remaining space and divide that up between all the "starred" columns or rows; it's nothing too funky so it shouldn't screw up your frames :) You can also specify the width values (yes, there must be at least 2 frames specified in a frameset) in pixels instead of relative values (percentages). Here is a miniature snapshot of a sample frameset straight from my desktop:
If you had wanted a page with 3 columns, just specify 3 columns; for example: <Frameset COLS="200,30%,*"> (just throwing in all the various width specification methods I've just mentioned =]). Note that the second and third widths are of variable size depending on the size of the browser window. And that would look something like this (in my 800x600 window): What if you had wanted rows? Instead of COLS, feel free to use ROWS [which will render the heights/widths from the top down] =) Can you specify both a set of COLS and ROWS in the same <FRAMESET> tag? Nope. It's a methodical tag that does one task at a time. Within the <FRAMESET> tags, you have the <FRAME> tag. If you've been faithfully viewing the code for each example frameset I've built so far, you might notice that for each subwindow (frame) you specify in the COLS or ROWS attribute, you'll have a <FRAME> tag to define what page it loads by using the SRC attribute: <FRAME SRC="thispage.html"> Each <FRAME> tag has the ability to tell the browser its "name" and the page it loads in it's window. There are some other attributes we can (optionally) set for each <FRAME> tag, but we'll get to that in a moment. Say that we wanted to build a frameset that would achieve an effect such as:
This is where the frames hierarchy comes in; just as <TABLE>s can be nested, so can <FRAMESET>s. We will have to create a frameset inside another frameset. Let's take it one step at a time. The first (outer) frameset should be two columns. How can I tell? Because that rectangular frame window in the right top area of the browser diagram doesn't stretch across the screen (it is contained within an inner frameset). The code for the two columns:
<Frameset COLS="50%,*"> This is how I imagined it: First we take the browser window and draw a line down the window, creating two columns (COLS). Then, in the second column, I draw a horizontal line across it, to create the two rows (top and bottom). The code within the second frameset would look like:
<Frameset COLS="50%,*"> From personal experience, I've noticed that older browsers tend to "break" when using deeply nested framesets. For example, when you try to specify a frameset within a frameset within a frameset or through consecutive nested framesets. A quick fix for this incompatibility is to use the <FRAME> tag instead and specify a separate page that contains another set of <FRAMESET>s. In that example we just worked on, we could've not used nested framesets and instead at this point written something like:
<Frameset COLS="50%,*"> ...Which loads another page (secondframeset.html) which apparently contains the code:
<html> Let's try one more... Skip it if you're impatient to get to the special attributes you can use to better control your frames, but the examples do get tougher as we continue :)
If you have a sharp eye, you'll notice that there are 5 columns (two wide ones at the ends, a wide one in the middle, and two narrow ones bordering the center). So let's generate that code shall we? First, we may realize that the wide columns might be the same size. Also, the two narrow columns are very narrow (do I hear a 'duh' coming on?) and would probably be used as border lines. So the easiest thing to do would be to set the narrow columns to an absolute pixel width... perhaps 10 and let the leftover 3 columns take up the rest of (which is most of) the browser window space.
<Frameset COLS="*,10,*,10,*"> Now let's work on that middle frame where the rows start appearing. I think that we could approach this by first creating three rows and then in the middle row, create 3 columns. The top and bottom rows are thin, so lets go with the good ol' size of 10. So the code with the nested three rows would look like:
<Frameset COLS="*,10,*,10,*">
Finally, add the three columns in the middle row, smack dab in the middle of the entire browser window. The middle column here seems to be larger than the left and right ones, so let's make the smaller columns of width 10 :)
<Frameset COLS="*,10,*,10,*">
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
©1999 Team 26297 "Ad Infinitum Web." All rights reserved. Any reproduction of this document for commercial or redistribution purposes without the permission of the author is forbidden.