HTML Dog
跳至导航

HTML 标签:iframe

内联框架,或称嵌套浏览上下文——本质上,是在一个网页中嵌入另一个网页。

可选属性

属性 描述 可能的值
src 要嵌入的网页的地址。 URL。
name 框架的唯一名称。 文本。
sandbox 应用安全规则,限制嵌入页面的内容。 无。或者,可以通过由单个实例或空格分隔的列表组成的值来解除单个限制,该列表包含:
  • allow-forms
  • allow-pointer-lock
  • allow-popups
  • allow-same-origin
  • allow-scripts
  • allow-top-navigation
srcdoc 直接将内容应用于嵌入的页面。会覆盖 src HTML。
width 框架的像素宽度。 数字。
height 框架的像素高度。 数字。
全局属性

示例


<iframe src="https://htmldog.cn/references/html/tags/iframe" name="htmlDogIframe"></iframe>

<!-- or, securely, applying restrictions... -->

<iframe sandbox src="https://htmldog.cn/references/html/tags/iframe"></iframe>

<!-- or, just allowing forms and scripts... -->

<iframe sandbox="allow-forms allow-scripts" src="https://htmldog.cn/references/html/tags/iframe"></iframe>

<!-- or, applying something a little bit different... -->

<iframe srcdoc="<p>Clunky, not funky, fool.</p>" src="https://htmldog.cn/references/html/tags/iframe"></iframe>