Frames were used in earlier versions of HTML to divide a web page into multiple sections, each displaying a different HTML document.
⚠️ Note: Frames are not supported in HTML5.
Modern websites use CSS Flexbox, Grid, or iframes instead.
However, it’s useful to learn about frames for understanding legacy websites.
A frame allows you to display multiple web pages within one browser window.
Each section is independent and can load a separate HTML document.
Before HTML5, the <frameset> tag replaced the <body> tag to define the layout of frames.
<frameset cols="50%,50%">
<frame src="left.html">
<frame src="right.html">
</frameset>
<!DOCTYPE html>
<html>
<head>
<title>HTML Frames Example</title>
</head>
<frameset cols="50%,50%">
<frame src="menu.html">
<frame src="content.html">
</frameset>
</html>
The browser window is split into two vertical sections:
<!DOCTYPE html>
<html>
<head>
<title>Frames Rows Example</title>
</head>
<frameset rows="30%,70%">
<frame src="header.html">
<frame src="main.html">
</frameset>
</html>
The page is divided into two horizontal sections (a header and a main content area).
<frameset rows="25%,75%">
<frame src="header.html">
<frameset cols="30%,70%">
<frame src="menu.html">
<frame src="content.html">
</frameset>
</frameset>
Browsers that do not support frames can show a fallback message using <noframes>.
<noframes>
<p>Your browser does not support frames.</p>
</noframes>
Modern websites use the <iframe> tag instead of framesets.
<iframe src="content.html" width="600" height="400" title="Content Frame"></iframe>
Displays the content.html page inside the current page.
| Tag | Description | Example |
|---|---|---|
<frameset> |
Defines frame layout | <frameset cols="50%,50%"> |
<frame> |
Defines each frame | <frame src="page.html"> |
<noframes> |
Shown if browser doesn’t support frames | <noframes>Fallback</noframes> |
<iframe> |
Modern method to embed pages | <iframe src="page.html"></iframe> |