Skip to main content

HTML Tags

HTML <frame> Tag

Written by Updated

The <frame> tag in HTML was used to define a specific region within a <frameset> that could display a separate HTML document.
Frames allowed web developers to split the browser window into multiple sections, each loading a different webpage.
This tag is deprecated in HTML5 and replaced by more modern layout techniques using CSS Flexbox, Grid, or iframes.

Syntax

html

<frameset cols="50%,50%">
  <frame src="left.html">
  <frame src="right.html">
</frameset>

Attributes

AttributeDescription
srcSpecifies the URL of the document to be displayed in the frame.
nameAssigns a name to the frame (used for linking).
scrollingControls whether scrollbars appear (yes, no, or auto).
noresizePrevents resizing of the frame by the user.
frameborderDefines whether the frame has a border (1 or 0).
marginwidthSets the left and right margins of the frame content.
marginheightSets the top and bottom margins of the frame content.

Example

html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Frame Tag Example</title>
</head>

<!-- Frameset replaces body when using frames -->
<frameset cols="50%,50%">
  <frame src="https://freethings.org.in" name="leftFrame" frameborder="1" scrolling="auto">
  <frame src="https://hindigems.com" name="rightFrame" frameborder="1" scrolling="auto">
</frameset>

<noframes>
  <body>
    <p>Your browser does not support frames. Please use a modern browser.</p>
  </body>
</noframes>
</html>

Browsers dropped <frame> and <frameset> in HTML5, so the example above renders nothing. The same split-view layout is built today with <iframe> elements, which you can run below.

The modern replacement: <iframe>

html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Modern Replacement for Frames</title>
  <style>
    body { margin: 0; font-family: Arial, sans-serif; }
    .frame-row { display: flex; height: 220px; }
    .frame-row iframe { flex: 1; border: 1px solid #cbd5e1; }
  </style>
</head>
<body>
  <div class="frame-row">
    <iframe src="/samples/frame-left.html" title="Left panel"></iframe>
    <iframe src="/samples/frame-right.html" title="Right panel"></iframe>
  </div>
</body>
</html>

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
YesYesYesYesYesYes

No Major browser support for this <frame> tag.

Notes

  • The <frame> tag cannot be used inside the <body> tag - it must be used within a <frameset>.
  • Frames are deprecated due to accessibility, usability, and SEO issues.
  • Use CSS layouts or <iframe> for embedding external content instead.

Conclusion

The <frame> tag was once used to divide a webpage into multiple sections displaying separate documents.
It is now obsolete in HTML5 and replaced by modern layout methods like CSS Grid, Flexbox, or embedding techniques using <iframe>.