Frameset- and Frame Attributes

version 2.00
or: »Everything you always wanted to know about frame attributes«
 

There seem to be a certain amount of uncertainty about the usage and the effect of the various attributes (parameters) that can be used in connection with the two HTML-elements (tags):  <frameset>  and  <frame>.

Because of that I have testet the effect of the different attributes in a number of browsers.  The results from this can be seen in the two tables below - compared to the HTML 4.0x standard.

The use of the individual attributes and the effect in the different browsers are elaborated in the "Comments" part.

 
element: <frameset> <frame> <frameset> & <frame>
attribut: rows & cols onLoad & onUnload src name scrolling noresize target longdesc title style id & class
HTML 4.0x pixels / % / * / n* script URI text yes / no / auto + identifier URI text CSS CSS identifier
Netscape 2.02 pixels / % / * / n* JavaScript URI text yes / no / auto + - - - - -
Netscape 3.04 pixels / % / * / n* JavaScript URI text yes / no / auto + - - - - -
Netscape 4.8 pixels / % / * / n* JavaScript URI text yes / no / auto + - - - buggy buggy
Netscape 7.1 pixels / % / * / n* JavaScript URI tekst yes / no / auto + - - - - -
Explorer 3.03 pixels / % / * / n* Jscript, VBScript URI text yes / no / auto + - - - - -
Explorer 4.01 pixels / % / * / n* Jscript, VBScript URI text yes / no / auto + - - text CSS CSS identifier
Explorer 5.00 pixels / % / * / n* Jscript, VBScript URI text yes / no / auto + - - text CSS CSS identifier
Opera 2.12 pixels / % / * / n* - URI text yes / no / auto + - - - - -
Opera 3.21 pixels / % / * / n* JavaScript URI text yes / no / auto + - - - - -
Opera 3.51 pixels / % / * / n* JavaScript URI text yes / no / auto + - - - - -
Opera 3.60 pixels / % / * / n* JavaScript URI text yes / no / auto + - - - - -
 
attribut: frameborder border framespacing bordercolor marginwidth marginheight
element: <frameset> <frame> <frameset> <frame> <frameset> <frame> <frameset> <frame> default min. default min.
HTML 4.00 - 0 / 1 - - - - - - - 2 - 2
HTML 4.01 - 0 / 1 - - - - - - - 1 - 1
Netscape 2.02 - - - - - - - - 10 1 15 1
Netscape 3.04 0 (no) / 1 0 (no) / 1 pixels  (6) 0 / 1 - - color color 10 1 15 1
Netscape 4.8 0 (no) / 1 0 (no) / 1 pixels  (6) 0 / 1 - - color color 8 1 8 1
Netscape 7.1 0 (no) / 1 0 (no) / 1 pixels  (6) 0 / 1 - - farve farve 8 0 8 0
Explorer 3.03 0 / 1 0 / 1 - - pixels  (2) - - - 10 0 15 0
Explorer 4.01 0 / 1 0 / 1 - - pixels  (2) - color color 10 0 15 0
Explorer 5.00 0 / 1 0 / 1 pixels (2) - pixels  (2) - color color 10 0 15 0
Opera 2.12 -  (1) -  (1) pixels  (2) - - - - - 5 1 5 1
Opera 3.21 -  (0) -  (0) pixels  (2) - - - - - 5 1 5 1
Opera 3.51 -  (0) -  (0) pixels  (2) - - - - - 5 1 - 0
Opera 3.60 -  (0) -  (0) pixels  (2) - - - - - 5 1 5 1
 
 Bold =  default value.
+=  suported, but requires no indication of value.
-=  not supported or not encompassed by the standard.
buggy=  defectively supported.
 

Comments

Note !  This is not a basal course in the use of frames, but a go through of the effect of the different attributes in the tested browsers.

Rows and Cols

  1. Rows and cols states the number of rows and collumns together with the height of the rows respectively the width of the columns in a frameset.
  2. The size can either be stated in pixels, in percentage, with an * or with n*.  If * is used, the size of the frame in question becomes the space remaining when the rest of the frames has been allocated their relative space.
  3. Stating for example  cols="*, 2*"  sets up two frames where the right frame is twice as wide as the left one.  This corresponds to  cols="33%, 66%",  cols="33%, *"  or  cols="*, 66%".
  4. If both rows and cols are stated in the same <frameset> tag, the individual frames will be inserted in the order in which they are written - from left to right and top to bottom.
  5. The usage of both rows and cols in the same <frameset> tag can give give peculiar results, especially if there are nested framesets (<frameset> within another <frameset> tag).  It can therefore strongly be recommended to use either cols or rows in a <frameset> tag and not use both in the same tag.
  6. If rows and cols are used in the same <frameset> tag, then Netscape will weave the borders of the frames over and under each other.
  7. Netscape does not respect the stated height and width values of the frames, but often adjusts the sizes by several pixels depending on the size of the browser window.  This can make it extremely difficult to make graphic elements in adjacent frames "fit together" in Netscape.
    Note!  If absolute values for rows and cols is stated with numbers that are divisible by 5, then Netscape seems to be far better at respecting the values.
    Netscape 7.x respects the stated values.
  8. Explorer and Opera don't change the stated height and width sizes of frames untill the browser window is minimized so much that it becomes difficult to show all the frames.
  9. In small browser windows there is a risk with Explorer that some frames might not be shown at all.  That risk is smaller in Netscape and Opera, since these two browsers rather attemts to show all frames.
  10. Some HTML-editing programs fancies constructions like:
      <frameset cols="80,*" rows="100%">
    
    rows="100%" is here her completely without consequence, hence it can be removed.
  11. A "hidden" frame can be made with this construction:
      <frameset rows="100%,*" border=0 framespacing=0>
        <frame src="main.htm" frameborder=0>
        <frame src="hidden.htm" frameborder=0>
      </frameset>
    
    though this doesn't work in Opera which shows hidden.htm in a frame with the height of 24.
  12. Fundamentally there is no limit to the number of frames in a browser, but many browsers runs into problems displaying and/or updating frames when there are more than 15.  Some browsers even have problems with fewer frames, so it is not recommended to use more than approximately 8 frames at the same time.

OnLoad and onUnload

  1. Intrinsic events that triggers a script when the whole frameset is loaded respectively when it is undloaded.
  2. OnLoad isn't executed until the full content of all frames is loaded.
  3. Since the type of script (script language) cannot be stated for intrinsic events like onLoad and unOnload, the type of script that is to be used on the page should be stated elsewhere.  This can be done with a META-tag in the header of the document - for example:
       <META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
    
    Of course this only matters to browsers that supports more than one script language or doesn't support the script language used for that onLoad and/or onUnload events.

Src

  1. Src states the file that is to be loaded into the frame in question.  Usually it is a HTML file, but it can for example also be a graphic file or a sound file.
  2. If src is a HTML file this file can either be an ordinary HTML document or it can be another frameset.

Name

  1. Provides the single frame with a name that can be used in links and scripts to define in which frame a link has to be opened.
  2. In HTML the name is used in connection with the "target" attribute in the elements <a>, <area>, <base>, <form> and <link>.
  3. For instance to make a link open a page in a frame with the name "main" use:  <a href="page.htm" target="main">
  4. Target can be set for all links on a page at once by using:  <base target="main">.  <base> has to be put between the <head> and </head> tag of the page.

Scrolling

  1. If scrolling="yes" is used, the browsers inserts scrollbars the following way:
    1. Netscape 4.x and older plus Opera and Explorer 3.x always inserts both horizontal and vertical scrollbars.
    2. Explorer 4.x and 5.x always inserts a vertical scrollbar, but only inserts a horizontal scrollbar if the width of the document requires it.
    3. In Netscape 4.x and older and Explorer 4.x (not 5.x) scrollbars has a different color if the size of the document does not necessitate a scrollbar.
    4. In Netscape 4.x and older and Explorer 4.x and 5.x the scrolling arrows are marked as inactive if the size of the document doesn't necessitate scrollbars.
    5. Netscape 7.x shows neither horizontal nor vertical scrollbars, if the size of the document doesn't necessitate scrollbars.
  2. No browsers supports the use of the scrolling attribute in <frameset> tags.
  3. Since all browsers has scrolling="auto" as default, there really isn't any reason to use: scrolling="auto".

Noresize

  1. Noresize is used to indicate that the user cannot change the size of a frame by dragging at its borders.
  2. Noresize requires no parameters and is of no significance if there are no borders between the individual frames.

Target

  1. According to the HTML 4.0 standard the target attribute can also be used in the <frame> tag, but none of the tested browsers seems to support this.

Longdesc

  1. Longdesc can be used to state the address of a file containing a description of each individual frame.
  2. It is intended as a help, for example to blind persons and is a supplement to the "title" tag.

Title

  1. Title is used to give a more thorough description of a HTML element in the same way as for example "alt" in the <img> tag.
  2. Title used as an attribute must not be mistaken for the title of a HTML document which is put between the <title> and </title> tags in the header (<head>) of the document.
  3. In connexion with frames only Netscape 7.x plus Explorer 4.x and 5.x supports this attribute.  If title is stated in a <frameset> tag, then a little yellow help text will appear at the cursor when it is held over a border.

Style, id and class

  1. These attributes are used in connection with Cascading StyleSheets (CSS) in order to state the appearance of all HTML elements.
  2. The CSS support of Netscape 4.0x in connection with frames is useless.  At best only part of the framset is displayed - more often the frameset will not be shown at all - and at worst the browser crashes.
  3. Explorer 4.x and 5.x supports the CSS border property in connection with frames.  It is not the ordinary borders of the frameset that can be changed, but extra borders inserted between already existing borders.
  4. Thus, with Explorer it is possible for example to insert a wide red border around the whole framset by using: style="border: 10px solid red".

Frameborder

  1. The effect of using frameborder:
    1. Netscape 2.x: White edge (1 pixel) around the active frame.
    2. Netscape 3.x: Black edge (1 pixel) around the active frame.
    3. Netscape 4.x: Transparent (white) edge (1 pixel) around all frames.
    4. Netscape 7.x: Frameborder=0 removes the borders - just like the border=0 does. But you cannot use frameborder to set the border width.
    5. Explorer 3.x: Black edge (1 pixel) around all frames.
    6. Explorer 4.x/5.x: Gray/white edge (1 pixel) around all frames (creates a 3D effect).
    7. Opera 2.x always inserts a black edge (1 pixel) around the active frame.
    8. In Opera 3.x frameborders can be disabled in the browsers setup, but they can not be changed via the frameborder attribute.
  2. Frameborder stated in a <frame> tag disregards frameborder stated in a prior <frameset> tag in both Netscape 4.x or older and Explorer.
  3. Frameborder=0 in <frameset> causes the 3D effect and coloration of the borders to be removed in both Netscape og Explorer.
  4. Frameborder=0 in <frame> removes the 3D effect but not the color of the borders in Explorer.
  5. Frameborder=0 in two adjacent <frame> or <frameset> tags removes the 3D effect and color of the borders in Netscape.
  6. Frameborder=1 in <frame> re-establishes the 3D effect and color of the borders in Netscape, but not in Explorer, if frameborder=0 in the <frameset>.
  7. If the bordes is not shown in 3D, they can not be dragged in Netscape.

Border

  1. Border states the width of the frame borders in Netscape, Explorer 5.x and Opera.
  2. The border attribute only has effect if it is inserted in the first <frameset> tag in Netscape 4.x or older and Opera.
  3. Border=0 in a <frame> tag removes the 3D effect, color and the frameborder in Netscape.
  4. In Netscape 4.x or older the space for the borders are taken equally from the two adjacent frames, so that the size of the individual frame actually becomes smaller.
  5. Because of this, Netscape 4.x or older rounds the with of the borders up to the nearest even number.  Border=1 thus becomes border=2.
  6. In Opera the borders are put in between the frames, so that the frames maintains their sizes.

Framespacing

  1. Framespacing states the width of the frame borders in Explorer.
  2. Framespacing has an effect in both the first and the subsequent <frameset> tags.
  3. In Explorer the borders are put in between the frames, so that the frames maintains their sizes.
  4. There is no 3D effect on the borders in Explorer 3.x.
 
The safe and sufficient way to totally remove borders consequently is to use:
border=0 framespacing=0 in the first <frameset> and frameborder=0 in all the <frame> tags.
 

Bordercolor

  1. Bordercolor states the color of the frame borders in Netscape and Explorer 4.x and 5.x
  2. The color can be stated with either hexadecimal rgb values (for example: #66CCFF) or with med Netscape's Color Names (also applicable in Explorer).
  3. Bordercolor stated in a <frame> tag disregards bordercolor stated in a <frameset> tag in both Netscape and Explorer.
  4. In Netscape different bordercolors can be stated for the individual frames and framesets.
  5. If different bordercolors are stated for two adjacent frames in Netscape, the bordercolor is set to the color stated for the first of the two frames.
  6. In Explorer all borders get the color stated in the first <frame> or <frameset> tag.

Marginwidth

  1. Specifies the width of the left and right margin of the document inside the frame.
  2. Can not be set to less than 1 pixel in Netscape 4.x or older and Opera.
  3. If marginwidth is stated without also stating the marginheight, then the marginheight is set to 0 in Explorer and in Netscape.
  4. Opera 2.12 and 3.21 adds 10 pixels to the right margin.
  5. Marginwidth can also be stated in the <body> tag for each individual document in Netscape 4.x. and here it can be set to 0.  The equivalent attribute in Explorer is: "leftmargin" (and if necessary "rightmargin").

Marginheight

  1. Specifies the height of the top and bottom margin of the document inside the frame.
  2. Can not be set to less than 1 pixel in Netscape 4.x or older and Opera.
  3. If marginheight is stated without also stating the marginwidth, then the marginwidth is set to 0 in Explorer and in Netscape.
  4. Opera 3.51 can not change the marginheight, which is always set to 0.
  5. Marginheight can also be stated in the <body> tag for each individual document in Netscape 4.x. and here it can be set to 0.  The equivalent attribute in Explorer is: "topmargin" (and if necessary "bottommargin").

 
Home
16057