HTML <frame> Element

The <frame> element was historically used inside a <frameset> to divide the browser window into separate areas, with each frame displaying a different HTML document. Frames were once commonly used for layouts such as a permanent navigation menu beside a separate content area.

Historical Syntax

Older HTML documents using frames may contain markup similar to the following:

<frameset cols="25%,75%">
  <frame src="navigation.html">
  <frame src="content.html">
</frameset>

In a supporting browser, this divided the window into two vertical frames. The first displayed navigation.html and the second displayed content.html. This code is shown for historical reference only and should not be used in modern HTML.

Attributes

The <frame> element historically supported several element-specific attributes that controlled the document loaded into the frame and aspects of its presentation and behavior. These attributes are obsolete along with the element and are included here to help identify and understand older HTML source code.

Attribute Description
frameborder Controlled whether a border was displayed around the frame.
longdesc Specified a URL containing a longer description of the frame's contents.
marginheight Specified the amount of vertical space between the frame's contents and its edges.
marginwidth Specified the amount of horizontal space between the frame's contents and its edges.
name Assigned a name to the frame so links and other navigation could target it.
noresize Prevented users from resizing the frame by dragging its border.
scrolling Controlled whether scrollbars were displayed for the frame.
src Specified the URL of the document displayed within the frame.

Historical Use

Frames allowed a browser window to display several independent HTML documents at the same time. A common design placed a navigation menu in one frame while links from that menu loaded different documents into another named frame.

This allowed part of the browser window, such as the navigation area, to remain visible while the content frame changed. Each <frame> represented a separate document with its own URL, scrolling area, and browsing context.

The individual <frame> elements were defined inside a <frameset> element, which determined how the browser window was divided into rows or columns.

Why It Became Obsolete

Frames created numerous usability and technical problems. Because several independent documents could appear within one browser window, the address shown in the browser did not always represent the content a visitor was viewing. Bookmarking, linking directly to content, browser history, printing, navigation, and search engine indexing could all become more difficult.

Frames also complicated accessibility and made page layouts harder to maintain. As CSS developed into a powerful layout system, websites could keep navigation and other common page areas visually consistent without loading each area as a separate HTML document.

The <frame>, <frameset>, and <noframes> elements are obsolete in modern HTML.

Modern Alternative

For normal webpage layouts, create a single HTML document with meaningful structural elements and use CSS to arrange the page. A navigation area and main content area, for example, can be placed side by side using CSS Grid or Flexbox without dividing the browser window into separate documents.

<div class="page-layout">
  <nav>
    <a href="/index.html">Home</a>
    <a href="/services.html">Services</a>
    <a href="/contact.html">Contact</a>
  </nav>
  <main>
    <h1>Welcome</h1>
    <p>The page content appears here.</p>
  </main>
</div>
.page-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
}
Play in Editor

If the actual goal is to embed another HTML document within the current page rather than create the page layout, the <iframe> element may be appropriate. An <iframe> should not, however, be treated as a replacement for the old frameset-based approach to designing an entire website.

Legacy Browser Support

Frames were widely supported by desktop browsers during the period when frameset-based websites were common. Modern browsers retain some handling of old frame markup for compatibility with historical webpages, but frameset documents are obsolete and must not be used for new websites.

Any remaining frameset-based website should be redesigned using modern HTML and CSS rather than relying on legacy browser support for <frame>.

For detailed legacy browser compatibility information, see Can I Use: HTML <frame> Element .

The <frame> element was used with the obsolete <frameset> and <noframes> elements. The modern <iframe> element can be used when another document genuinely needs to be embedded within a webpage.

Specifications

The <frame> element is listed as an entirely obsolete, non-conforming feature in the WHATWG HTML Living Standard . Modern websites should use normal HTML document structure and CSS for page layout.