By Doug Lawson
January 24, 1997
When I think about explaining frames, I can't help thinking about ranchers
and cattle rustlers.
Ranchers are the types that set up the farms, and work day after day at
maintaining the status quo. Feeding the cows, slopping the pigs. Get the
picture?
Then the cattle rustlers swoop down and take it all away from them. They
build their own ranch out of the efforts of other people's work.
A frames page is pretty much the same thing--a rustler of HTML. In
creating frames, you create one page that pulls a whole lot of separate
HTML pages together, and puts them in pens. The code's a bit different from
normal pages in several ways. Here's how it works.
Insert <html> and your <title> the way you normally would. Instead of the
normal "<body>" tag, though, you'll use "<frameset>" in its place. This
warns the browser involved you're going to be doing some rustling, and it
better get ready.
Then you want to decide how you're going to divide up
your new ranch. You can divide your page either horizontally or
vertically, to start with -- not both. If you add "rows," you've divided it horizontally. If you add "cols," you've divided it vertically. You add this specification to the <frameset> tag, and then specify how big you want each section to be.
You can set the size of your rows or columns using either pixels, or a percentage of the whole screen. Including an asterisk means: "Fill up the rest of the space."
We rustlers, of course, always have very little time on our hands for the
mundane chores. So we'll keep this simple. We'll go for a long, narrow
frame on the left hand side, with a larger section to the right hand side.
We'll say that the left hand side is for the pigs, the right hand side is
for the cows, and since cows are bigger we want them to have more room.
So, our page (we'll call it "rustler.html") now looks like this:
<html>
<title>Rustling Up A Ranch of Your Own</title>
<frameset cols="20%,*">
This gives us a column on the left, that's 20% of the screen, and a column
on the right, that's everything else. (We could also say
"80%" there, but let's be lazy, and use the "*.")
So we have the Ranch now, we just need the livestock. You'll need two
other HTML files here to rustle up, let's call them "pigs.html" and
"cows.html." You'll want to tell the main Rustler page that these files are the
"source" for each frame. You do this using the "src" tag, the same way
you would for an GIF or JPEG image. Also, give each file a name using "name=".
(Just in case you need to refer to them later, basically.)
So, calling up the livestock looks like this...
<frame src="pigs.html" name="pigs">
<frame src="cows.html" name="cows">
You do it in order, so the first source is the first frame (the 20% one),
the second is the other (the *).
After that, you just need to close up the <frameset> and the page itself.
</frameset>
</html>
So the Ranch Page as a whole now looks like...
<html>
<title>Rustling Up A Ranch of Your Own</title>
<frameset cols="20%,*">
<frame src="pigs.html" name="pigs">
<frame src="cows.html" name="cows">
</frameset>
</html>
Pretty easy, huh? So why do Web designers get the big bucks? (Because
we're MEAN, that's why. But that's another article.)
What sites use frames well? Personally, I like the smooth elegance of The Mississippi Review, and the easy to
navigate interface of Wired Magazine's newly launched News ranch. Also, the Marathon
Spoiler pages do a great job, I think, of organizing a good deal of
information in an easy-to-read format. (They also help you kick alien
butt.)
Keep in mind that frames have their downsides.
The first is that not every browser is able to handle it, or handle it
well. Visitors to your Ranch need to be using either Netscape 2.0 or
better, Internet Explorer 3.0 or better, or the most current AOL browser.
Fortunately, most everyone is these days. Netscape 2.0 has a problem when
you hit the "back" button; it sends you back to wherever you were before
visiting the Ranch (since it reads each HTML file on the Ranch as the same page).
Also, too much of a good thing will kill the page -- remember your Ranch is
only so big, partner; it's the size of your visitor's screens and no bigger.
Too many frames will create an overly-cluttered and confusing layout,
particularly if the visitor's screen is small. Stick to two or three
frames at the most, if you can.
In the end, though, the Internet is the place for experimentation, and
frames can be fun to play with. If someone doesn't like what you've done
with your page, you've got an excuse. Tell 'em "Hey, I've been framed!"
If that doesn't work, you could always blame it on me...
Tune in next week for how to create a non-frames version of a frames page...
When Doug Lawson's not
writing, editing, or producing online game shows for BJP Interactive, he runs a chinchilla
ranch somewhere in central Virginia. Really. No, not really.
|