English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
<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.
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 ‹/›
IEFirefoxOperaChromeSafari
All mainstream browsers support the <frame> tag.
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".
HTML5 Does not support <frame> tag, HTML 4.01 Supports <frame> tag.
In HTML, the <frame> tag does not have a closing tag. In XHTML, the <frame> tag must be properly closed.
Attribute | Value | Description |
---|---|---|
frameborder | 0 1 | HTML5 Not supported. Specifies whether to display a border around the frame. |
longdesc | URL | HTML5 Not supported. Specifies a page that contains a long description of the content within the frame. |
marginheight | pixels | HTML5 Not supported. Specifies the top and bottom margins of the frame. |
marginwidth | pixels | HTML5 Not supported. Specifies the left and right margins of the frame. |
name | name | HTML5 Not supported. Specifies the name of the frame. |
noresize | noresize | HTML5 Not supported. Specifies that the size of the frame cannot be adjusted. |
scrolling | yes no auto | HTML5 Not supported. Specifies whether to display scrollbars within the frame. |
src | URL | HTML5 Not supported. Specify the URL of the document to be displayed in the frame. |
In HTML 4.01 In the <frame> tag supports the following standard attributes:
Attribute | Value | Description |
---|---|---|
class | classname | Specify the class name of the element |
id | id | Specify the unique id of the element |
style | style_definition | Specify the inline style of the element |
title | text | Specify additional information of the element |
For a complete description, please visitStandard 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.
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.