| Frames |
|
|
Scripting
|
Course Contents
|
| Basics | Formatting | <FRAMESET> | <FRAME> | <NOFRAMES> |
|
Basic Frames Structure:
An HTML Document constructed in frames is complex. It consists
of framesets and frames. It should also contain
a noframes segment.
An HTML Document constructed in frames contains other HTML Documents which are
included and displayed within its frames. It may contain, itself,
only the minimal HTML code necessary to establish the basic structure of its frames.
At a miniumu, it must contain one frameset and one frame but it may also be
very complex and contain many
framesets and frames.
The basic command syntax required to set an HTML Document in
frames is shown below:
Example:
Result:
|
|
The frameset tag is used to define a structured container in which
frames or other framesets will be displayed by the browser. The frameset
command parameters establish the row and column layout for the display screen
using the general syntax below:
Where:
These can be stipulated in any of three ways:
Examples:
Command Extensions:
In addition to the general ROWS and COLS command parameters Netscape
also supports the following extensions:
NOTE: The latter two command parameters and their arguments can also be applied
to frames. (see below)
The frame tag is used to define the content of only one of the
frames established within the structure of the frameset as defined by the
row and column arrangement. Each identified frame location within the
frameset must have a corresponding frame definition.
The frame is the ultimate display unit of the framed document.
The frame command parameters establish all the display attributes of the
frame being defined as well as the content to display within the frame. The
command parameters are laid out in the table below:
URL defines the path to an HTML Document which
will be loaded into this frame.
The URL provided may be either relative, if a base href
has been provided, or it may be a full address and path.
This command parameter instructs the browser what HTML Document to
load and display within the confines of the defined frame.
If the HTML Document references cannot be found, then an error message
is generated requiring the user to bypass the error and the frame
is left blank.
frame_name defines a target name that will be associated
with this frame in the framed HTML Document.
This command parameter attaches a name to the frame which can be used
by other HTML Documents to reference this particular frame using its
name as a target.
Any HTML Document link that addresses the named frame must include in
the anchor the target="frame_name" argument in order for the code
to be loaded in the appropriate frame.
The permitted values are:
The default is auto.
This parameter determines whether or not the frame being defined will be scrollable.
By default, the browser may attach scroll bars to a frame which is too large to display
fully in the available space. Making frames non-scrollable can cause serious display
difficulties for users who are viewing the HTML Document at low screen resolutions.
It is best to allow the browser to "determine" whether or not scrolling is necessary.
This command parameter requires no argument.
All browsers allow frames to be resized by by the user unless this parameter
disallows resizing of a frame.
This prevents the browser from allowing the user to resize a frame. In most
cases, this is a bad idea, since users who are viewing the page at lower screen
resolutions may need to resize a frame to see its complete content. This parameter
should be used with caution.
The number n defines the width, in pixels, of the margins
of the frame. The default is zero (0).
These optional parameters set the left and right (marginwidth) and top and bottom
(marginheight) margins or "white space" to allow within the defined frame.
Internet Explorer -
Netscape -
These optional parameters determine the presence or absence of a border around
the frame. Both Internet Explorer and Netscape browsers can display frames
with no borders but in order for the HTML Document to display properly in either
browser, both forms of the parameter and arguments must be provided.
This may appear redundant but each browser will read only the form of the command
parameter which it recognizes. The redundant code will not generate an error.
The number n defines the width, in pixels, of the space to allow
between frames.
This optional parameter is recognized only by Internet Explorer. It is used
to define the amount of "white space" or the "gutter" to allow between adjacent
frames.
The desired color of the frame border is specified for the red, green and blue
color components, respectively, in hexadecimal format.
This optional parameter is recognized only by the Netscape browser. It
defines the color to be used by the browser when displaying the frame border.
Example:
Non-Framed Document Segment:
An HTML Document which is set in frames should also contain a Non-Frames
Document Segment defined within the
Example:
[ The Non-Framed Document Segment ]
. . . some message or standard HTML code goes here . . .
If no Non-Framed Document Segment is defined for a framed HTML Document
then the page will load with a browser error. It is customary, at
the very least, to include a brief message in the Non-Framed Document Segment which
informs the low-end browser user that the framed HTML Document
cannot be displayed in the browser. Many Web users find this practice annoying.
It is far better to place HTML code within the Non-Framed Document Segment which
produces a reasonable facsimile of or alternative to the framed HTML Document.
This requires extra work to manage and maintain but, it can prevent a significant
portion of the potential viewer population from being arbitrarily excluded from the
website. This is a particularly important consideration for commercial sites.
You are here: NetStrider » Tutorials » HTML » FRAMES « |
||||