HTML框架:在同一个窗口中显示多个页面

HTML Iframe
    iframe 用于在网页内显示网页。<iframe> 定义内联的子窗口(框架)
    添加 iframe 的语法:<iframe src=”URL”></iframe>。URL 指向隔离页面的位置。
    Iframe – 设置高度和宽度:height 和 width 属性用于规定 iframe 的高度和宽度。
    iframe 的高度和宽度属性值的默认单位是像素,但也可以用百分比来设定(比如 “80%”)。
    Iframe边框:frameborder 属性规定是否显示 iframe 周围的边框。设置属性值为 “0” 就可以移除边框。
实例

<iframe src="../iframe/iframe.jpg"></iframe>
<iframe src="iframe.htm" width="200" height="200"></iframe>
<iframe src="iframe.htm" frameborder="0"></iframe>

注释:一些老的浏览器不支持内联框架 iframe,如果得不到支持,iframe 是不可见的。

使用 iframe 作为链接的目标:
    iframe 可用作链接的目标(target)。链接的 target 属性必须引用 iframe 的 name 属性。
实例

<iframe src="href" name="iframe_a"></iframe>
<p><a href="http://www.taobao.cn" target="iframe_a">taobao.cn</a></p>
<p><a href="http://www.linwute.com" target="iframe_a">linwute.com</a></p>

注释:由于链接的目标匹配 iframe 的名称,所以链接会在 iframe 中打开。

569 Views
分享你的喜爱
linwute
linwute

我要像梦一样自由,像大地一样宽容;
在艰辛放逐的路上,点亮生命的光芒;
我要像梦一样自由,像天空一样坚强;
在曲折蜿蜒的路上,体验生命的意义;

留下评论

您的电子邮箱地址不会被公开。 必填项已用*标注