现在的位置: 网页制作教程HTML教程 >正文
HTML语言

HTML中Iframe使用方法-HTML教程第十九讲

发表于2016/12/23 HTML教程 0条评论 ⁄ 热度 1,999℃

本文主要介绍iframe在html中的使用方法。

HTML中Iframe语法:

<iframe src="URL"></iframe>

设置Iframe高度和宽度

height 和 width 属性用于规定 iframe 的高度和宽度。

属性值的默认单位是像素,但也可以用百分比来设定(比如 "60%")。

<iframe src="demo1.html" width="400" height="300"></iframe>

设置Iframe边框

frameborder 属性规定是否显示 iframe 周围的边框。

设置属性值为 "0" 就可以移除边框:

<iframe src="demo2.html" frameborder="0"></iframe>

iframe 可用作链接的目标(target)。

链接的 target 属性必须引用 iframe 的 name 属性:

<iframe src="demo3.html" name="iframe_a"></iframe>
<p><a href="http://www.webym.net" target="iframe_a">webym.net</a></p>
  • 暂无评论