此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

HTMLFencedFrameElement:height 属性

Deprecated
To be removed

This feature is pending removal from browsers. Using it now may lead to broken functionality in future updates. Following the announcement that Chrome will maintain its current approach to third-party cookies, Chrome decided to withdraw certain Privacy Sandbox features including the <fencedframe> element and related APIs.

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

HTMLFencedFrameElementheight 属性用于获取并设置对应 <fencedframe> 元素的 height 属性的值,该属性指定了元素的高度。

嵌入内容的尺寸可能由 <fencedframe>config 对象的内部 contentWidthcontentHeight 属性设置。在这种情况下,更改 <fencedframe>widthheight 将改变页面上嵌入容器的大小,但容器内的文档将按比例缩放以适应新的尺寸。嵌入文档报告的宽度和高度(即 Window.innerWidthWindow.innerHeight)将保持不变。

以 CSS 像素为单位表示元素高度的字符串。默认值为 150

示例

js
const frame = document.createElement("fencedframe");
frame.height = "320";

规范

规范
Fenced Frame
# dom-htmlfencedframeelement-height

浏览器兼容性

参见