|
Frames are quite an advanced subject, so I recommend that you don't attempt them
until you are able to code HTML well.
Frames are used to show multiple HTML documents in one browser window. They
are often used to create navigation bars that stay the same throughout a
site. Frames programming can get a little difficult, though, so it's best
to make sure that you know your HTML properly first.
To make some frames, you first need a 'host' file that doesn't contain any
content, but sets up the frameset. Instead of a <BODY> tag,
framesets have a <FRAMESET> </FRAMESET> tag. This tag
must have either a COLS="column widths" or a
ROWS="row heights" attribute. In these attributes, write
the widths/heights going from left to right or top to bottom, separated by
commas. You can use pixels, percentages or the * symbol - this means 'the
rest of the screen'.
Inside the <FRAMESET> tag comes the <FRAME> tag,
which has no </FRAME> equivalent. This has two essential
attributes - NAME="name of frame", which sets the name of
the frame (this can be anything at all - myframe, nav, fred or
oo are
all possibilities!) so that you can reference it later, and
SRC="filename", which is the filename of the document
to go in the frame.
You might also want to add a <NOFRAMES> </NOFRAMES> tag,
for browsers that do not support frames. Just put normal HTML inside it - a
simple copy of your content is a good idea.
Lastly, close the whole thing off with a </FRAMESET> tag.
When you're writing <A> tags, don't forget to add a
TARGET="frame name to load into" attribute. Just enter the
name of the frame you want the link to appear in, or use the special code
_top to destroy the frames and load the link into the full browser
window, or _blank to load it in a new window.
For example, the code:
<FRAMESET COLS="30, 20%, *">
<FRAME NAME="frame1" SRC="firstframe.html">
<FRAME NAME="secframe" SRC="2ndthing.html">
<FRAME NAME="main" SRC="start.html">
<NOFRAMES>
I'm afraid you
can't view the frames on my site, so
here is a version with no frames.
</NOFRAMES>
</FRAMESET>
would produce a window with three columns - one which was 30 pixels wide,
was called frame1 and loaded the page firstframe.html, a second which was
20% of the window's width, was called secframe and displayed 2ndthing.html
and one last one that filled up all the rest of the available space, was
called main and loaded start.html. If someone viewed the page with an old
browser, they would see a message about a version with no frames.
What would this look like?
|