
![]()
|
Frames are yet another way to organize information on your web site. When you implement frames on your site, the web browser divides its display area into multiple sections, known as frames, and loads a different HTML document into each frame. This allows you to keep one frame constant and have it control the content that appears in the other frames. Many web sites use this technique by keeping a constant menu in one frame alowing the user to navigate through their content in a separate frame. The basis of designing frames is the <FRAMESET> tag. The <FRAMESET> tag is placed in the header of your HTML document and is used to designate the format of the frames on your page. Two attributes are used within the <FRAMESET> tag: ROWS and COLS. Only one of these attributes may be used per tag. Both ROWS and COLS follow the same format and are used to specify the height of horizontal frames (ROWS) or the width of vertical frames (COLS). They also are used to specify the number of frames on a page. This is done by stating the attribute, followed by a list of the sizes of your frames. The sizes can either be in number of pixels or in the percentage of the browser window that it covers. You can also use a * to assign the remaining browser space to that frame. An example a propper frame set tag would be: This creates a set of vertical frames, the first of these with a width of 20 pixels, the second taking up 50% of the browser window, and the third filling the rest of the screen. You can also add border="number" to your <FRAMESET> tag to specify the width, in pixels, of the borders between frames. Once you have your <FRAMESET> tag established, you need to create the individual <FRAME> tags that specify which HTML file to insert in each frame. Since you have three frames in the frameset, you need three <FRAME> tags inside of the <FRAMESET> tag. Each <FRAME> tag is in the following format: The scrolling attribute of the <FRAME> tag tells the browser whiether or not to display a scroll bar on the given frame. The default value for this is "AUTO" wherein the browser only displays a scroll bar if the content of the frame warants it. Each frame should also hae a name attribute so that you can set it as the target of a link. No two frames should have the same name. The coding for an entire frameset might look like this:
The results of this code can be seen in Frames example #1The coding for a horizontal framset with no borderws looks like this:
The results of this code can be seen in Frames example #2Aside from using just horizontal or vertical framesets, you can nest one type of frameset within another like so:
Here, a vertical frameset is put in the place of the center frame in the horizontal frameset.The results of this code can be seen in Frames example #3 If you are going to use frames on your web page it is important to remember that not all older browsers will display frames. Because of this, it is a good idea to include a vervion of your page that does not require frames. This version is placed in the body of your HTML document and in enclosed within the <NOFRAMES> and </NOFRAMES> tags. This tag is ignored by older browsers and the content inside of it is displayed. Browsers that support frames do not display the <NOFRAMES> information unless the user has disabled frames in the browser's preferences. For information on using the TARGET attribute of the link tag to point your links to different frames, check out our links tutorial. ![]() ![]()
![]() |
![]() |
|
![]() |