| [main] [misc] [graphics] [page design] [site design] [xhtml] [css] [xml] [xsl] [schema] [javascript] [php] [mysql] | |||||
Note that all external links will open up in a separate window. This is a stripped down version of these pages for older browsers. These pages are really meant to be viewed in a standards compliant browser. |
The Frameset TagThese tutorials are about XHTML, the Extensible Hypertext Markup Language. The
| ||||
| Frame 1 | Frame 2 |
| Frame 3 | Frame 4 |
When specifying the number of rows or columns, you do not give a single number, instead you provide a comma separated list of how large you want each row or column to be. This value can be an absolute pixel value, a percentage, or a ratio value. Percentages end in percent signs, such as 50%. Ratio values end in asterisks, such as 2*. Above there are just asterisks in the example. Although you could write 1*, it is not necessary and usually just the asterisk is placed there.
Absolute values define how many pixels a row or column spans. You should never use absolute values for all the frames in a frame set because you have no way of knowing the screen resolution the user is using. They may also have resized their browser window to something other than the full screen.
The total size of frames cannot exceed the size of the browser window. The contents inside the frame can be larger, since frames can be scrolled, but the frame itself is just a window, and pretty much by definition, a set of windows cannot be larger than the window containing it.
If the frame sizes are specified with absolute values and and the total is less than the size of the window, the values will be treated as ratio values, discussed below. If the total of absolute frame sizes is larger than the size of the window, then some browsers will treat them as ratio values while other will allocate the space as listed, meaning anything that is entirely off the edge of the screen will not be accessible.
Percentages specify what percentage of the window height the row uses or what percentage of the screen width the column uses. For instance, rows="25%, 75%" would split the screen into two frames, one taking up the top 25% of the screen. The other taking the bottom 75%.
Another example, cols="50%, 75%, 75%" is a little trickier. The total between the three columns is 200%. Since you cannot take up more than 100% of the browser window, the numbers are proportionally reduced to fit the window. In this case, they are all cut in half. The command would then be equivalent of cols="25%, 37.5%, 37.5%".
Ratio values are based on whatever space is left over on the screen. For instance, cols="100, *" will create two frames side-by side, set the first frame to 100 pixels wide and set the second frame to whatever is left over. Absolute values take precedence over percentages and ratio values. This example is a common way of setting up frames, having one fixed and another variable size to allow the page to adapt to different browsers.
Another example: cols="*, 2*" will also split the screen into two columns, the first being one-third of the screen and the second being two-thirds of the screen. If it helps you can think of it this way: There are three asterisks, so the screen is treated as if it were split into three equal parts. The first column gets assigned one part since it has one asterisk and the second column gets assigned two parts since it has two asterisks.
Now here is a trick question. How do you intentionally hide a frame?
The way you hide a frame is to make sure all the screen real estate is spoken for before you specify the hidden frame. For instance, rows="50%, 50%, *". In this case, the last row is designated to take up whatever is left over after 100% has been specified in the previous two. Hidden frames are of no use to us here, but can be useful in online applications as a handy place to store data.
These pages can be found at:
[http://academ.hvcc.edu/~kantopet/]
Copyright 2003 -- Peter L. Kantor[kantopet@hvcc.edu]
Last Updated August 2003