home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

HTML 4.0 Sourcebook
(Publisher: John Wiley & Sons, Inc.)
Author(s): Ian S. Graham
ISBN: 0471257249
Publication Date: 04/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


Finally, the attributes BORDER, BORDERCOLOR, FRAMEBORDER, and FRAMESPACING control presentation aspects of the frame borders, as described below:

BORDER=“number” (optional; Netscape Navigator 3+ and Internet Explorer 4+ only)Specifies the width of the frame border, in pixels, the default being 5. BORDER can only be set on the outermost FRAMESET element. Scrollbars, if needed in a frame, are placed inside the frame border. This attribute is not supported by Internet Explorer 3. Figure 7.8 shows an example of a borderless frame document.
BORDERCOLOR=“#rrggbb,”color” (optional; Netscape Navigator 3+ and Internet Explorer 4+ only)Specifies the color of the frame borders. This is overridden by a BORDERCOLOR specification of a FRAMESET lying inside another FRAMESET or by the BORDERCOLOR specification of a specific FRAME. This only affects true borders (FRAMEBORDER=“yes”). If FRAMEBORDER=“no,” then the border is invisible, and always takes the default background color of the browser window, independent of the color of the pages loaded into the frames. This attribute is not supported by Internet Explorer 3.
COLS=“comma-separated frame widths” (one of ROWS or COLS is mandatory)Specifies the widths of a selection of vertically oriented frames, where the terms specifying the widths of the different columns are separated by commas. Widths are specified as described in Table 7.1, while the number of comma-separated entries equals the number of frames within the FRAMESET. An example (see Figure 7.1) is COLS=“10%, 45%, 45%,” which declares three columnar frames—the first frame occupies 10% of the available width, and the second and third occupy 45% each.


Figure 7.8  The same document as displayed in Figure 7.4 but with BORDER=”0” applied to the outer FRAMESET (see Figure 7.1). Note that the frame borders are now invisible. In addition, the frames are not resizable—the user cannot use the mouse to grab and move the frame edges.

FRAMEBORDER=“yes” or “1,” “no,” or “0” (optional)Specifies how the frame borders should be drawn. FRAMEBORDER=“yes” (or “1”) draws three-dimensional borders (the default), while “no” (or “0”) draws a plain border. If BORDER=“0,” then no borders are drawn regardless of the FRAMEBORDER setting. The default is to draw borders.


Tip: Internet Explorer 3 vs. Netscape Navigator Incompatibility

Internet Explorer 3 supports FRAMEBORDER, but only accepts the values 0 or 1 and not the values “yes” or “no.” The following procedure will ensure the correct type of border on all browsers: For three-dimensional borders, omit the FRAMEBORDER attribute, since the default is to to have 3-D borders. For plain borders, use FRAMEBORDER=”no,” which eliminates borders on all browsers.


FRAMESPACING=number” (optional; Internet Explorer only)Specifies the spacing to leave between internal frames, in pixels. This attribute is not supported by Netscape Navigator. On Internet Explorer 4, this overrides any BORDER value.

Table 7.1 Frame Size Value Specifications for FRAMESET, COL, and ROW Attribute Values

Type Format Description
Fixed Pixel number Specifies the absolute frame size, in pixels, where n is the integer number of pixels.
Percentage number% Specifies the frame size as a percentage of the total available height or width, where n is an integer. If the total of all specified frames is greater than 100%, then all frames are rescaled until the total is 100%. If the total is less than 100% and there are no relative frames (see below), then all frames are rescaled until the total is 100%. If the total is less than 100% and there are relative-sized frames, the remaining space is assigned to the relative frames.
Relative Size number* Specifies the size as a free-floating, relative value—all space remaining after allocating fixed pixel or percentage frames is divided amongst all relative-sized frames. An optional integer preceding the asterisk weights the space contribution; thus, the string “2*,3*,*” would allocate 2/6 of the remaining space to the first frame, 3/6 to the second frame, and 1/6 to the third frame.

ROWS=comma-separated frame heights” (one of ROWS or COLS is mandatory)Specifies the heights of a selection of horizontally oriented frames. Heights are specified as described in Table 7.1, and are separated by commas, while the number of entries gives the number of FRAMEs within the FRAMESET. An example is ROWS=“80, 3*, *, 100” which declares four frame rows. The first (top) frame is 80 pixels high, and the fourth (bottom) frame is 100 pixels high. The second frame will occupy 3/4 of the remaining height, while the third frame will occupy the final 1/4 of the remaining height.

FRAME Element: A FRAME Within a FRAMESET

Usage: <FRAME>
Can Contain: empty
Can Be Inside: FRAMESET
Attributes: CLASS, ID, STYLE, TITLE, (onBlur, onFocus, onLoad, onUnload: Internet Explorer 4 only)
Attributes: BORDERCOLOR, FRAMEBORDER, LONGDESC, MARGINHEIGHT, MARGINWIDTH, NAME, NORESIZE, SCROLLING, SRC

FRAME defines the content of a frame within a FRAMESET element—the SRC attribute references the HTML document to be placed within the FRAME. The attributes MARGINWIDTH, MARGINHEIGHT, NORESIZE, and SCROLLING define the physical properties of the frame. The NAME attribute assigns a specific name to the FRAME and allows the frame to be targeted using the TARGET attribute of anchor elements. All attributes are optional, including SRC; if SRC is absent, the frame is simply left empty. FRAME is an empty element, as the content of the frame is defined via the SRC attribute.

The ROWS or COLS attribute specifies the number of frames that must be inside the FRAMESET. It is an error if a FRAMESET does not actually contain this number of FRAME and/or FRAMESET elements.

The CLASS, ID, and STYLE attributes can assign style sheet formatting rules to the FRAME (e.g., borders, sizes, etc.). Note that these rules only affect the layout and formatting of the frame, not the formatting of the document referenced by a FRAME. Care should be taken with such rules, due to possible interaction between properties specified by a FRAMESET and those specified by a style sheet. Also, an author should note that there are several bugs in Netscape Navigator 4 implementation of style sheets with frames, so that it is best to avoid using style sheets with FRAME and FRAMESET.

The following is an example of correctly defined FRAMEs (comments in italics):

<FRAMESET ROWS=“10%, 80%, 10%>  3 rows, narrow top and bottom

  <FRAME SCROLLING=”no“ SRC=”logo+buttonbar.html“>  1st frame
  <FRAMESET COLS="20%, 80%">  2nd frame is a FRAMESET
    <FRAME NAME="navigation" SRC="navigate.html">        containing 2 frames
    <FRAME NAME="main" SRC="main/start.html">
  </FRAMESET>
  <FRAME SCROLLING="no" SRC="credits.html">        3rd frame
</FRAMESET>

....


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.