|
Resource Index
Frames
Frames were once very unpopular,but as most browsers can handle them they
have been accepted. Tastefully done, they are great navigation tools.
The Basic Frame Tags:
<FRAMESET> ... </FRAMESET>
Declares a new group of columns or rows of frames
<FRAME SRC="document.html">
The location of the document in the frame
<NOFRAMES> ... </NOFRAMES>
Text to display if the browser can not see frames
Frames are an invention of Netscape which allow the
browser to display multiple HTML documents in one browser window. There are
two parts to the HTML code which is required to create frames. The majority
of the code is contained in a new HTML file which defines how to load each
frame in the window. The second part of a good frame design is written in
each of the documents which is in a window of the frame. This code determines
how each of the links in the current frame is loaded into the framed document.
Frames are a very dangerous part of HTML because
it is very easy to totally destroy there usefulness in any document. Before
you use frames on your pages, take some time to think about how you want them
to interact with the page. Frames generally look better on machines running
high resolution graphics. Most framed sites are easiest to use if monitor
resolution is set to at least 800x600.
The best designs for framed pages are those which
have one large window which contains the document of interest, and one or
more others which are for navigational purposes. Don't want to move around
the focal point of the site. The user should be able to tell at a glance
which frames local navigational links will effect.
One way to think about frames is to think of each
window as a tree computer abstract data structure. If this doesn't make sense,
think of frames as a family tree. Each node or person in a tree can have
children. The same is true for frames. If the window is the 'root' of the
tree each frame of that tree can also have subframes. This understanding
is very important if you want incorporate JavaScript into your frames for
accessing multiple layers of different frames. Lets get onto looking at some
examples of how to control the frames.
The <FRAMESET> Tag:
<FRAMESET COLS="50%,50%">
<FRAME SRC="a.html">
<FRAME SRC="b.html">
</FRAMESET>
|
|
|
<FRAMESET ROWS="50%,50%">
<FRAME SRC="a.html">
<FRAME SRC="b.html">
</FRAMESET>
|
|
Frames can have rows and columns. The flags COLS and ROWS are
used within the FRAMESET tag to define each frame's size. COL
and ROWS can be set to a number, a percent or a *. The values can
be used interchangeably. Commas are placed in-between each value.
NUMBER: this value defines the size of the
given frame in terms of pixels.
<FRAMESET ROWS="75%,25%">
- Divides the window into two frames the one on the left 75% of the window,
on the right 25%.
PERCENT: frame size is set to a percent based on the parent frame.
If there are no parent frames, the size is determined by the window size.
<FRAMESET ROWS="200,100">
- Divides the window into two frames, one of 200 pixels, the other of 100
pixels. If the window is wider than 300 pixels, any extra space will be left
empty.
*: This is the default value which means divide whatever space is left undefined
equally between all remaining frames.
<FRAMESET ROWS="20%,*,*">
- This divides the window into three frames, one will be 20% of the window,
the others will each be 40% because 100%-20%=80%. Half of 80% is 40%.
<FRAMESET ROWS="100,*,*">
- This divides the window into three frames, the first will be 100 pixels,
the other two will be half of whatever size is remaining in the window.
Layering Frames
Eventually you will want to create a frame with both rows and columns. For
this reason, frames can be layered when they are declared. The following
code creates a frame with three columns. The first column is 30% of the window,
the second will be 30%, the third column consists of two frames which each
are 50% of the height of the window.
<FRAMESET ROWS="30%,*,40%">
<FRAME SRC="a.html">
<FRAME SRC="b.html">
<FRAMESET COLS="50%,*">
<FRAME SRC="c.html">
<FRAME SRC="d.html">
</FRAMESET>
</FRAMESET>
|
| Frame A |
| Frame B |
| Frame C |
Frame D |
|
|
The <FRAME> Tag:
The <frame> tag is used inside <frameset> to control how each
individual document is displayed in the window. Frame has the following modifiers:
SRC="document.html" --- The path and name
of the document which this frame shows when the page is loaded.
NAME="x" --- Frames can be given names which
can be TARGETED to links from other documents. This attribute is optional,
and no default value.
<FRAME SRC="main.html"
NAME="MAIN">
MARGINWIDTH and MARGINHEIGHT --- While the browser automatically
determines the margin width and height, you can force it to take a specific
value. The minimum value must be larger than 1 and can not prevent text from
being displayed in the window.
SCROLLING --- Determines whether a scroll
bar should be placed if the page is larger than the frame size. The default
value is AUTO, but sometimes a scroll bar will show up when you don't want
one or when one is not necessary. Scrolling can be set to either NO, YES,
or AUTO
<FRAMESET COLS="*,*">
<FRAME SRC="scroll.html" SCROLLING="YES">
<FRAME SRC="scroll.html" SCROLLING="NO">
</FRAMESET>
NORESIZE --- There are no attributes to this tag, but it prevents
the user from resizing the window. This will often result in user "unfriendly"
pages, however if you want to make sure the user is seeing something in a
frame while they're on the page, (like ads or announcements) this is one
way to do it.
The <NOFRAMES> Tag:
Everything between a set of <NOFRAMES> tags is ignored by browsers
using frames. There are two different things you can do with this tag.
- Tell the user to get Netscape v2.0 (or something else which supports
frames)
- Or, include the HTML for a non-framed version of the document.
|