Article

Designing with Frames - an Introduction

Page: 1 2 3 4 5 6 7 8 9 Next

More on <FRAME>

As you are no doubt aware by now, the main function of the <FRAME> tag is to set the initial contents of each frame in your frameset. Like the <FRAMESET> tag, it also accepts several other attributes that allow you to change the way the individual frame works. Unless otherwise indicated, these attributes work in Netscape 2 and above, and Internet Explorer 3 and above.

NAME="name"

Allows you to set a name for your frame. name is a piece of text, usually enclosed in quotes. Giving your frame a name allows you to target it with hypertext links, and manipulate it using JavaScript. Examples of these techniques are shown in following sections of this article.

FRAMEBORDER="n"

Sets whether or not to display a 3D border around this frame. If n is 1, a 3D border will be displayed. If n is 0, the border will be invisible. You can also use YES instead of 1, and NO instead of 0. Using this in a <FRAME> tag will override the FRAMEBORDER attribute of the enclosing <FRAMESET>, if any. This attribute works with Netscape and Internet Explorer versions 3 and later.

NORESIZE

Keeps the user from being able to change the size of this frame by dragging its border with the mouse. The syntax is simply NORESIZE; it does not need to be assigned a value.

SCROLLING="value"

Defines whether or not scroll bars should be displayed in this frame. value may be YES, NO or AUTO. If YES, horizontal and vertical scroll bars will always be displayed, even if the contents of the frame are small enough to fit inside the frame all at once. If NO, scroll bars will never be displayed, even if the contents of the frame are too large to fit within the frame all at once. AUTO indicates that the frame should behave normally; displaying scroll bars only when the contents exceed the size of the frame.

NOTE: Unless you take special care, a frame that uses NORESIZE and SCROLLING=NO may present a problem for users with smaller screen sizes. Don't use this combination unless you need to. If you do, be sure to test it on a 640x480 pixel screen to be sure it is still useable.

MARGINWIDTH="n"

Sets the amount of space between the left and right borders of the frame and its contents. n is a number of pixels. Internet Explorer browsers accept values of 0 or higher, but Netscape browsers only accept values of 1 or higher, and will take 0 to mean 1.

MARGINHEIGHT="n"

Sets the amount of space between the top and bottom borders of the frame and its contents. n is a number of pixels. Internet Explorer browsers accept values of 0 or higher, but Netscape browsers only accept values of 1 or higher, and will take 0 to mean 1.

TIP: If you want to have the contents of the frame flush against its edges, you must combine several techniques for different browsers. First, use a MARGINWIDTH and MARGINHEIGHT of 0 for Internet Explorer browsers. For Netscape 4, you must also set a MARGINWIDTH and MARGINHEIGHT of 0 in the <BODY> tag of the HTML file(s) to be loaded into the frame in question. These will not be recognized by Netscape 3 or earlier, though, for which there is a minimum margin of one pixel that cannot be avoided in frames.

Once again, the effects of these attributes are best demonstrated by playing around with them yourself. Always keep in mind which browsers will support each feature you use. Never use an attribute that may exclude part of your target audience.

If you liked this article, share the love:
Print-Friendly Version Suggest an Article

Sponsored Links