<frame>

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

<frame> HTML 元素定义了可以显示另一个 HTML 文档的特定区域。框架应在 <frameset> 内使用。

¥The <frame> HTML element defines a particular area in which another HTML document can be displayed. A frame should be used within a <frameset>.

不鼓励使用 <frame> 元素,因为存在某些缺点,例如性能问题以及使用屏幕阅读器的用户缺乏可访问性。代替 <frame> 元素,<iframe> 可能是优选的。

¥Using the <frame> element is not encouraged because of certain disadvantages such as performance problems and lack of accessibility for users with screen readers. Instead of the <frame> element, <iframe> may be preferred.

属性

¥Attributes

与所有其他 HTML 元素一样,此元素支持 全局属性

¥Like all other HTML elements, this element supports the global attributes.

src Deprecated

该属性指定框架将显示的文档。

name Deprecated

该属性用于标记帧。如果没有标签,每个链接都将在其所在的框架(最接近的父框架)中打开。有关详细信息,请参阅 target 属性。

noresize Deprecated

此属性可防止用户调整框架大小。

scrolling Deprecated

该属性定义滚动条的存在。如果不使用该属性,浏览器会在必要时添加滚动条。有两种选择:"yes" 用于强制滚动条,即使没有必要;"no" 用于强制不滚动条,即使有必要也是如此。

marginheight Deprecated

该属性定义帧之间边距的高度。

marginwidth Deprecated

该属性定义帧之间边距的宽度。

frameborder Deprecated

该属性允许你指定框架的边框。

示例

¥Example

框架集文档

¥A frameset document

框架集文档具有 <frameset> 元素而不是 <body> 元素。<frame> 元素放置在 <frameset> 内。

¥A frameset document has a <frameset> element instead of a <body> element. The <frame> elements are placed within the <frameset>.

html
<!doctype html>
<html lang="en-US">
  <head>
    <!-- Document metadata goes here -->
  </head>
  <frameset cols="400, 500">
    <frame src="https://web.nodejs.cn/en/HTML/Element/iframe" />
    <frame src="https://web.nodejs.cn/en/HTML/Element/frame" />
  </frameset>
</html>

如果要将另一个 HTML 页面嵌入到文档的 <body> 中,请使用 <iframe> 元素。

¥If you want to embed another HTML page into the <body> of a document, use an <iframe> element.

规范

Specification
HTML Standard
# frame

¥Specifications

浏览器兼容性

BCD tables only load in the browser

¥Browser compatibility

也可以看看

¥See also