English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Directory

HTML: <frame> tag

<frame> is an HTML element that defines a specific area where another HTML document can be displayed. Frames should be used within <frameset>. The use of <frame> is not recommended due to some drawbacks, such as performance issues, and the lack of accessibility for users of screen readers. Compared to <frame>, <iframe> should be promoted more.

Online example

Simple three-frame page:

<!DOCTYPE html>
<html>
<frameset cols="25,%*,25%">
  <frame src="sun.html">
  <frame src="venus.html">
  <frame src="mercur.html">
</frameset>
</html>
Test and see ‹/›

Browser compatibility

IEFirefoxOperaChromeSafari

All mainstream browsers support the <frame> tag.

Tag definition and usage instructions

HTML5 Does not support <frame> tag.

The <frame> tag defines the child windows (frames) within <frameset>.

Each <frame> within <frameset> can be set with different attributes, such as border, scrolling, noresize, etc.

Note:If you want to validate a page that contains frames, make sure <!DOCTYPE> Is set to "HTML Frameset DTD" or "XHTML Frameset DTD".

HTML 4.01 With HTML5Differences

HTML5 Does not support <frame> tag, HTML 4.01 Supports <frame> tag.

Differences between HTML and XHTML

In HTML, the <frame> tag does not have a closing tag. In XHTML, the <frame> tag must be properly closed.

Optional attribute

AttributeValueDescription
frameborder0
 1
HTML5 Not supported. Specifies whether to display a border around the frame.
longdescURLHTML5 Not supported. Specifies a page that contains a long description of the content within the frame.
marginheightpixelsHTML5 Not supported. Specifies the top and bottom margins of the frame.
marginwidthpixelsHTML5 Not supported. Specifies the left and right margins of the frame.
namenameHTML5 Not supported. Specifies the name of the frame.
noresizenoresizeHTML5 Not supported. Specifies that the size of the frame cannot be adjusted.
scrollingyes
 no
 auto
HTML5 Not supported. Specifies whether to display scrollbars within the frame.
srcURLHTML5 Not supported. Specify the URL of the document to be displayed in the frame.

Standard attributes

In HTML 4.01 In the <frame> tag supports the following standard attributes:

AttributeValueDescription
classclassnameSpecify the class name of the element
ididSpecify the unique id of the element
stylestyle_definitionSpecify the inline style of the element
titletextSpecify additional information of the element

For a complete description, please visitStandard attributes.

Event attributes

According to W3C standard, in HTML 4.01 In the <frame> tag does not support any event attributes.

However, all browsers support the onload event.

For a complete description, please visitEvent attributes.

Try the online example

Horizontal frame
This example demonstrates: how to create a horizontal frame using three different documents.

Mixed structure frame
This example demonstrates how to create a frame structure with three documents, and mix them in rows and columns at the same time.

Frame structure with noresize="noresize" attribute
This example demonstrates the noresize attribute. In this example, the frame is not resizable. Dragging the mouse over the border between frames, you will find that the border cannot be moved.