Controlling Frame Borders
= Index DOT Html by Brian Wilson =

Main Index | Element Index | Element Tree | HTML Support History
The Problem | The New Syntax
Cross-Compatibility Tips | Examples



The Problem
The rendering of the original frame syntax introduced in Netscape 2.0 produces a border between adjoining frames of static thickness and appearance. The 3.0 versions of both Internet Explorer and Netscape sought to extend the original syntax to allow control over these frame border appearance properties. One problem existed with this - the syntax each browser chose is slightly different from the other. Despite this incompatibility, it is possible to control these properties so that the desired result can be achieved in BOTH browsers.

The New Syntax
The following attributes are used for the FRAMESET element to control the border characteristics of all frames in the set. The FRAMEBORDER attribute is also usable with the FRAME element as well, where it controls the border around each particular frame.
FRAMEBORDER - Common Attribute
This is a boolean (off/on) value controlling the display of the border between frames. Netscape understands values of 'no'/'yes' and '0'/'1'. Internet Explorer only understands '0'/'1'. Default value in both browsers is to display a border ('yes' or '1'.)
NOTE: If FRAMEBORDER is set to '0' in Internet Explorer or Netscape and a positive FRAMESPACING or BORDER is also set, a gap will be rendered in place of the typical beveled-edge frame border.
BORDER - Common Attribute
This specifies an integer pixel value representing the thickness of the space between frames.
NOTE: If BORDER=0 is used in Netscape, it implicitly sets (overrides) FRAMEBORDER to 'no'/'0'.
FRAMESPACING - Internet Explorer Attribute
This also specifies an integer pixel value for the thickness of the space between frames.

Cross-compatibility Tips
  • Use '0' and '1' as the value for FRAMEBORDER (not 'no' and 'yes')
  • Use BOTH the BORDER and FRAMESPACING attributes (with the same value) to control the frame border thickness.
  • Explicitly set the FRAMEBORDER attribute (as well as the BORDER and FRAMESPACING attributes) to '0' if no border is desired.
  • NOTE: Several people have reported problems trying to achieve seamless content between frames in Netscape using only the attributes and methods described above - It looks like the best solution is to add the Netscape-only attributes MARGINHEIGHT and MARGINWIDTH to the BODY elements of your FRAME sub-pages. Adding these attributes and setting them to zero should bring your cross-frame content together and prevent discontinuity.
Examples
Example - 5 pixel border between frames
<frameset cols="50%,50%" frameborder="1" border="5" framespacing="5">
   <frame name="frame1" src="test.htm" />
   <frame name="frame2" src="test.htm" />
</frameset>
Example - No borders between frames (borderless - 0 pixels)
<frameset cols="50%,50%" frameborder="0" border="0" framespacing="0">
   <frame name="frame1" src="test.htm" />
   <frame name="frame2" src="test.htm" />
</frameset>


Boring Copyright Stuff...