HTML & CSS Wiki

READ MORE

HTML & CSS Wiki

This obsolete element is not recommended. Authors should generally find an alternative way to accomplish the same task while adhering to all best practices, or simply do without it if it is unimportant.


The HTML <frameset></frameset> element represents the meta structure of a document using frames. By replacing the <body> element in the document structure, this element defines the document layout in terms of areas of the screen containing sub-document URLs (the frame content).

Each <frameset> element can consist of a rows attribute, a cols attribute, or both. The rows attribute indicates that the sub-area is to be divided in to horizontal document "stripes", while the cols attribute defines vertical display areas. Using both attributes in a single <frameset> creates a grid of sub document areas.

If no rows or cols attributes are present in a <frameset> element, it is interpreted as a single row arbitrarily sized to fit the current window. If both rows and cols have been specified, sub-document definitions are distributed left-to-right, top-to-bottom of the frame layout. Nested <frameset> structures occur in place of where a corresponding <frame /> definition statement would appear.

Note: The * character used below in the rows and cols attributes deserves some explanation, as its use in this situation is unique in HTML. By itself, the * character specifies that any remaining frame width be devoted to the current frame. If there are multiple frames in the rows/cols specification that have the * character, the remaining space will be divided evenly between them. If the * character is preceded by an integer (N), that frame will receive N times as much of the remaining relative sized space as it would without the N prefix.


This element has become obsolete since HTML5.

Attributes[]

Attribute Value Description
border positive integer This attribute is used in the outermost <frameset> tag to globally set the border thickness for all frames within it.
bordercolor color name
color code
When this attribute is used, it attempts to set the colors of all borders for all frames in the frameset. This can be overridden on a frame-by-frame basis in the <frame /> tag.
cols pixels
%
*
This attribute specifies that the current window will be sub-divided into columns (vertical bands of framed content). Values to this attribute are separated by commas, and represent the horizontal widths of the resultant separate child frames in the current parent frameset. In theory, all values listed should account for, or sum up to, the full parent frame size. It is possible to abuse this, because the three types of values can be freely intermixed.
frameborder 1
0
This attribute gives the author the option of whether or not to have borders around all the frames in the <frameset>. This value can be overridden locally at the <frame /> level. 1 means there will be a border, and 0 means there will not.
framespacing positive integer This attribute specifies the size of the gap (in pixels) between individual frames in a frameset.
name alphanumeric string This attribute specifies the name of the link so that scripting languages may access it. The alphanumeric string must begin with an alphabetic letter.
rows pixels
%
*
This attribute specifies that the current window will be sub-divided into rows (horizontal bands of framed content). Values to this attribute are separated by commas, and represent the vertical height of the resultant separate child frames in the current parent frameset. In theory, all values listed should account for, or sum up to, the full parent frame size. It is possible to abuse this, because the three types of values can be freely intermixed.


Example:

<frameset rows="20,25%,*">
    <frame src="frame1.html" name="frame1" />
    <frame src="frame2.html" name="frame2" />
    <frameset cols="30%,*">
         <frame src="frame3.html" name="frame3" />
         <frame src="frame4.html" name="frame4" />
    </frameset>
<noframes>
    <body>
        This text will appear only if the browser does not support frames.
    </body>
</noframes>
</frameset>