W3docs

HTML <frameset> Tag

The <frameset> tag defines the structure of a frame, number of columns and rows and its place in a window. Tag description, attributes, using examples.

The <frameset> tag defines the structure of a frame (a zone in the browser window where another web page can be loaded), the number of columns and rows, and their respective sizes in pixels or percentages.

Danger

The <frameset> and <frame> tags are deprecated HTML tags.

You can use the <iframe> or <div> tags with different CSS properties for getting the same result.

Tip

The pages that contain frames can be validated only if the <!DOCTYPE> is set to XHTML Frameset DTD or HTML Frameset DTD.

Syntax

The <frameset> tag comes in pairs. The content is written between the opening (<frameset>) and closing (</frameset>) tags.

The <frameset> tag can contain one or several <frame> tags. It is allowed to nest one <frameset> tag in another if it is necessary to divide the windows into smaller ones.

Tip

The frameset document uses the <frameset> element instead of the <body> element. The frameset element may not contain any content, but instead it defines and names frames arranged in rows and/or columns.

Example of the HTML <frameset> tag:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <frameset cols="50%,50%">
    <frame src="https://www.w3docs.com/learn-html/html-basic.html">
    <frame src="https://www.w3docs.com/learn-css/css-syntax.html">
  </frameset>
</html>

Result

frameset example

Example of the HTML <frameset> tag with the rows attribute:

Example of the HTML <frameset> tag with the "rows" attribute:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <frameset rows="30%,40%,30%">
    <frame src="https://www.w3docs.com/learn-javascript.html">
    <frame src="https://www.w3docs.com/learn-git.html">
    <frame src="https://www.w3docs.com/learn-php.html">
  </frameset>
</html>

Attributes

AttributeValueDescription
colspixels, %, *Defines the number and size of frame columns. Not supported in HTML5.
rowspixels, %, *Defines the number and size of frame rows. Not supported in HTML5.
frameborder0, 1Specifies whether to display a border around the frames. Default is 1.
framespacingpixelsSpecifies the spacing between frames.

The <frameset> element also supports the Global Attributes.

Practice

Practice

What is the function of the HTML <frameset> tag?