HTML <frame> Tag
The <frame> tag defines a specific window, a frame, where we can load another web page. Use the src attribute to define the address of this web page. The web page can have several such frames.
The <frame> tag is used with the <frameset> element, which defines how to divide the window into frames.
DANGER
The <frame> is a deprecated HTML tag and is not supported in HTML5. Use the <iframe> tag instead.
When using frames, the <frameset> element replaces the <body> tag. The <frameset> element defines the structure of the frameset (zones in the browser window where other web pages are loaded), the number of columns and rows, and their size in percentages or pixels. Note that this tag is also deprecated in HTML5.
TIP
The pages that contain frames can be validated only if the <!DOCTYPE> declaration is set to HTML Frameset DTD or XHTML Frameset DTD.
Use the rows attribute of the <frameset> tag for defining horizontal frames, and the cols attribute for defining vertical frames.
Syntax
The <frame> tag is empty, which means that the closing tag isn’t required. But in XHTML, the <frame> tag must be self-closed (<frame />).
Example of the HTML <frame> tag:
Example of the HTML <frame> 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

Example of the HTML <frame> tag with the rows attribute:
Example of the HTML <frame> 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%,30%,40%">
<frame src="https://www.w3docs.com/learn-javascript.html">
<frame src="https://www.w3docs.com/learn-php.html">
<frame src="https://www.w3docs.com/learn-git.html">
</frameset>
</html>Advantages and disadvantages of the <frame> tag
Here are the advantages of this tag:
- It allows viewing several documents inside a single web page.
- Pages from different servers can be loaded in a single frameset.
The <frame> tag has the following disadvantages:
- It doesn’t allow bookmarking the web pages that are inside a frame.
- Using too many frames will cause a high workload on the server.
- It is not supported by many old browsers.
Frames vs iframes
The <frame> and <iframe> elements have similar behaviour. However, there are some differences between them. The <frame> tag is used with the <frameset> element, which defines how to divide the window into frames. Each of these frames has its content. The <iframe> tag inserts the frame directly into the same row with the other elements of the web page.
Attributes
| Attribute | Value | Description |
|---|---|---|
| bordercolor | color | Defines the color of the border around the frame. Not supported in HTML 5. |
| frameborder | 0, 1 | Defines if the border around the frame should be displayed or not. Not supported in HTML 5. |
| longdesc | URL | Defines a page which has a long content description of a frame. Not supported in HTML 5. |
| marginheight | pixels | Defines top and bottom margins of a frame. Not supported in HTML 5. |
| marginwidth | pixels | Defines left and right margins of a frame. Not supported in HTML 5. |
| name | text | Defines the name of a frame. (It is recommended to always set this attribute, especially in cases when it is necessary to upload a document to another via a link from one frame.) Not supported in HTML 5. |
| noresize | noresize | Defines if the user can change the frame size or not. Not supported in HTML 5. |
| scrolling | yes, no, auto | Defines if the scroll bar should be displayed or not. Not supported in HTML 5. |
| src | URL | Defines the URL of the page, which should be loaded in the frame. Not supported in HTML 5. |
The <frame> element also supports the Global Attributes.
Practice
Which of the following statements are true regarding the HTML <frame> tag?