Frames - Part 1 from Chapter 11 of HTML & XHTML: The Definitive Guide (3/4) | WebReference

Frames - Part 1 from Chapter 11 of HTML & XHTML: The Definitive Guide (3/4)

To page 1To page 2current pageTo page 4
[previous] [next]

HTML & XHTML: The Definitive Guide, Chapter 11: Frames

Controlling frame borders and spacing

The popular browsers provide attribute extensions that you may use to generally define and change the borders surrounding the frames in a frameset. The HTML 4 and XHTML standards prefer instead that you include these border-related display features via <style> tag attributes.

Both Internet Explorer and Netscape accept the frameborder attribute to disable or explicitly enable frame borders. (By default, every frame in a frameset as well as the frameset window itself is rendered with a 3D border; see Figure 11-1.) The two browsers' documentations disagree about the particular values for the frameborder attribute, but both acknowledge the other's conventions. Hence, setting the value of frameborder to 0 or no turns off borders (see Figure 11-2); 1 or yes turns on borders.

A simple six-panel frame layout
Figure 11-1: A simple six-panel frame layout

The frameborder attribute lets you remove the borders between frames
Figure 11-2: The frameborder attribute lets you remove the borders between frames

Internet Explorer and Netscape do disagree, however, as to how you may control the thickness of the borders. Internet Explorer Versions 5 and later support both the framespacing and border attributes, whose values are the number of pixels you want between frames.

These attributes affect all frames and framesets nested within the current frameset as displayed by Internet Explorer. In practice, you should set it once on the outermost <frameset> to create a consistent border appearance for all of the frames in a single page.

Netscape accepts only the border attribute to define the border width, with an integer value in pixels. Like Internet Explorer, Netscape lets you include the frameborder attribute with any <frameset> tag, affecting all nested frames and framesets. Unlike Internet Explorer, Netscape lets you include the border attribute only in the outermost <frameset>, ensuring that all frame borders are the same width within that <frameset>.

Since browsers ignore unsupported attributes, it is possible to define frame borders so that both browsers do the right thing. Just make sure to use the same framespacing and border values.

Finally, both Netscape and Internet Explorer Versions 5 and 6 let you control the color of the frame borders using the bordercolor attribute (Figure 11-3). It accepts a color name or hexadecimal triple as its value. For example, although you can't see their color, the borders in Figure 11-3 are light green, corresponding to the RGB value of "00CC00." You can find a complete list of color names and values in Appendix G.

Netscape accepts border and bordercolor attributes to control the color and spacing between frames
Figure 11-3:
Netscape accepts border and bordercolor attributes to control the color and spacing between frames


To page 1To page 2current pageTo page 4
[previous] [next]

Created: November 6, 2002
Revised: November 6, 2002

URL: http://webreference.com/authoring/languages/html/definitive/1/3.html