|
|
||||||||||||||
Chapter 8: FramesFrames allow you to display multiple webpages in a single window by dividing it into sections. Individual webpages are then loaded into each frame. The concept of creating frames is rather complex to grasp at first since the coding is more involved than for most other webpage functions. It is recommended that you use BestAddress HTML Editor's Frame Creator Wizard to develop your frame-based website. To start it, choose Wizards from the File menu. If you intend to use frames, you should note that not all browsers support them. If you do decide to use frames in your website, be sure to read the section at the end of this chapter on overcoming this problem. Creating the FoundationTo begin, you will need to create a special kind of webpage that will become the container for all the other webpages. This webpage is called a frame page. The frame page does not contain any content itself but simply defines the size and positioning of each individual frame as well as specifying what webpage is displayed in each. The construction of a frame page involves the use of the
Horizontal DivisionYou then need to specify if you want the frames to divide the screen horizontally or vertically. To divide the screen horizontally, use the
The following example demonstrates the entire layout of a frame page containing two frames. Note that there are no
If you load the above frame page into a browser, it will look something like this:
Vertical DivisionTo vertically divide the web browser window, specify percentages using the
Adding Content to FramesAt the moment, all the frame pages we've looked at so far only contain the basic layout of the frame divisions. They still need to be populated with webpages. As mentioned earlier, each individual frame will contain a separate webpage. To do this, you will need to use the
In the example above, the webpage TopPage.html will be displayed in the top frame division while BottomPage.html will be displayed in the bottom division. Frames and HyperlinksWhen one of your webpages contains a hyperlink, you will need to tell the web browser where the page should appear. Some browsers cause the link to display in the entire window while in others it might display in the wrong division you intended. To avoid this problem, you will need to give each of your frames a name and then specify in which frame the hyperlink should be opened. To name a frame, use the
Lets take a look at the previous example again, this time with all the frames named.
With the frames named, you can set the frame in which a link will load by adding the target= attribute to the link. For example:
As you can see, the It isn't necessary to add the
There are also three values that can be added to the Frame Layout OptionsThere are three extra attributes that you can add to the <frame> elements to change the way each frame operates: More Complex FramesYou can create more complex frames by combining horizontal and vertical frames. For example, you can divide the web browser window into two horizontal sections, and then divide the lower section into two vertical sections. The following example demonstrates this:
Supporting Non-Frame BrowsersAs mentioned at the beginning of this chapter, some browsers do not support frames. To solve this problem, add a
If an older browser visits your site, it will read through your frame's page, picking our the sections it understands. Even through it does not understand the <noframe> and </noframe> elements, it will display the text between them. Create Frames-based Sites EasilyAs mentioned at the beginning of this article, if you intend to create your own frames-based website, consider using BestAddress' Frames Wizard - it will guide you through the process visually, providing a large number of options and making the overall task much easier and trouble free. Where to from here?Learn how to create tables in Chapter 9: Tables. |
||||||||||||||
![]()
A Multimedia Australia website.
Copyright © 2001 - 2010 Multimedia Australia Pty. Ltd.
Australian Company Number 096 830 394. All rights reserved.
ABN 78 096 830 394
Terms of use. Disclaimer. Privacy Statement.