- Home
- /
- Tutorials
- /
- HTML Tutorial
- /
- HTML <frame> Tag
HTML Tags
HTML <frame> Tag
The frame tag defined one window inside a frameset, each loading its own page. Frames are obsolete, and current browsers do not show them in modern pages. If you need to show another page inside yours today, use an iframe.
The full story of how framesets worked and why they were dropped is in the frameset tag.
Syntax
html
<frameset cols="50%,50%">
<frame src="left.html">
<frame src="right.html">
</frameset>Attributes
| Attribute | Description |
|---|---|
| src | Specifies the URL of the document to be displayed in the frame. |
| name | Assigns a name to the frame (used for linking). |
| scrolling | Controls whether scrollbars appear (yes, no, or auto). |
| noresize | Prevents resizing of the frame by the user. |
| frameborder | Defines whether the frame has a border (1 or 0). |
| marginwidth | Sets the left and right margins of the frame content. |
| marginheight | Sets the top and bottom margins of the frame content. |
None of these attributes are valid in current HTML.
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 |
|---|---|---|---|---|
| No | No | No | No | No |
Pages with a modern doctype do not display <frame>. Some browsers still render it in very old documents for compatibility.
Good to know
- The replacement for showing another page is the iframe tag.
- The replacement for a shared menu on every page is a normal layout built with CSS Grid or Flexbox, with the menu included on each page.
HTML <frame> Tag exercises
Embed one panel
The frame element is gone. Show https://html5andcss3.org/samples/frame-left.html in the page the modern way, named Left panel.
Result
