next up previous
Next: Nesting frameset Tags Up: Frame Layout Previous: Frame Layout

The rows and cols attributes

Both attributes accept a quote-enclosed, comma-separated list of values that specify either the absolute or relative width (for columns) or height (for rows) for the frames. The number of attribute values determines how many rows or columns of frames Netscape will display in the document window.

You express each value in the rows or cols attribute in one of three ways:

As with tables, Netscape will match the size specifications you give a frameset as closely as possible. The browser will not, however, extend the boundaries of the main document window to accommodate framesets that would otherwise exceed those boundaries or fill the window with empty space if the specified frames don't fill the window. Rather, Netscape allocates space to a particular frame relative to all other frames in the row and column and resolutely fills the entire document window. (Did you notice a frame document window does not have scroll bars?)

For example:

<frameset rows="150,300,150">

creates three rows of frames, each extending across the entire document window.

The first and last frames are set to 150 pixels tall, the second to 300 pixels.

In reality, unless the browser window is exactly 600 pixels tall, Netscape automatically and proportionately stretches or compresses the first and last frames so that each occupies one quarter of the window space. The center row occupies the remaining half of the window space.




To see this absolute frame layout working for real click here.


Frame-row and column-size values expressed as a percentage of the window dimensions are more sensible. For instance, the following example is effectively identical to the previous one:

<frameset rows="25%,50%,25%">

Of course, if the percentages don't add up to 100 percent, the browser automatically and proportionally resizes each row to make up the difference.




To see this percentage frame layout working for real click here.


The asterisk (*) option for frameset rows and cols values.

This useful option the browser to size the respective column or row to whatever space is left over after putting adjacent frames into the frameset.

For example, when Netscape encounters the frame tag,

<frameset cols="100,*">

it makes a fixed-sized column 100 pixels wide, and then creates another frame column that occupies all of the remaining space in the frameset.




To see this Simple Asterisk frame layout working for real click here.


Here's a fancier layout example:

<frameset cols="10,*,10">

This one creates two very thin columns down the edges of the frameset and gives the remaining center portion to the middle column.




To see this frame layout working for real click here. Note that the two edges are VERY THIN


You may also use the asterisk for more than one row- or column-attribute value. In that case, the corresponding rows or columns equally divide the available space. For example,

<frameset rows="*,100,*">

creates a 100-pixel tall row in the middle of the frameset and equal-sized rows above and below it.




To see this frame layout working for real click here.

If you precede the asterisk with an integer value, the corresponding row or column gets proportionally more of the available space. For example,

<frameset cols="10%,3*,*,*">

creates four columns: the first column occupies 10 percent of the overall width of the frameset. Netscape then gives the second three-fifths of the remaining space, and the third and the fourth are each given one-fifth of the remaining space.




To see this frame layout working for real click here.

Using asterisks, especially with the numeric prefix, makes it easy to divide up the remaining space in a frameset.

Be aware, too, that unless you explicitly tell it not to, Netscape lets users manually resize the individual frame document's columns and rows, and hence change the relative proportions each frame occupies in their frames display. To prevent this, see the noresize attribute for the frame tag below.


next up previous
Next: Nesting frameset Tags Up: Frame Layout Previous: Frame Layout
Dave Marshall
9/28/2001